<s> """<STR_LIT>""" <EOL> from ironic import objects <EOL> from ironic . tests . unit . db import utils as db_utils <EOL> def get_test_node ( ctxt , ** kw ) : <EOL> """<STR_LIT>""" <EOL> db_node = db_utils . get_test_node ( ** kw ) <EOL> if '<STR_LIT:id>' not in kw : <EOL> del db_node [ '<STR_LIT:id>' ] <EOL> node = objects . Node ( ctxt ) <EOL> for key in db_node : <EOL> setattr ( node , key , db_node [ key ] ) <EOL> return node <EOL> def create_test_node ( ctxt , ** kw ) : <EOL> """<STR_LIT>""" <EOL> node = get_test_node ( ctxt , ** kw ) <EOL> node . create ( ) <EOL> return node <EOL> def get_test_port ( ctxt , ** kw ) : <EOL> """<STR_LIT>""" <EOL> db_port = db_utils . get_test_port ( ** kw ) <EOL> if '<STR_LIT:id>' not in kw : <EOL> del db_port [ '<STR_LIT:id>' ] <EOL> port = objects . Port ( ctxt ) <EOL> for key in db_port : <EOL> setattr ( port , key , db_port [ key ] ) <EOL> return port <EOL> def create_test_port ( ctxt , ** kw ) : <EOL> """<STR_LIT>""" <EOL> port = get_test_port ( ctxt , ** kw ) <EOL> port . create ( ) <EOL> return port <EOL> def get_test_chassis ( ctxt , ** kw ) : <EOL> """<STR_LIT>""" <EOL> db_chassis = db_utils . get_test_chassis ( ** kw ) <EOL> if '<STR_LIT:id>' not in kw : <EOL> del db_chassis [ '<STR_LIT:id>' ] <EOL> chassis = objects . Chassis ( ctxt ) <EOL> for key in db_chassis : <EOL> setattr ( chassis , key , db_chassis [ key ] ) <EOL> return chassis <EOL> def create_test_chassis ( ctxt , ** kw ) : <EOL> """<STR_LIT>""" <EOL> chassis = get_test_chassis ( ctxt , ** kw ) <EOL> chassis . create ( ) <EOL> return chassis <EOL> def get_test_portgroup ( ctxt , ** kw ) : <EOL> """<STR_LIT>""" <EOL> db_portgroup = db_utils . get_test_portgroup ( ** kw ) <EOL> if '<STR_LIT:id>' not in kw : <EOL> del db_portgroup [ '<STR_LIT:id>' ] <EOL> portgroup = objects . Portgroup ( ctxt ) <EOL> for key in db_portgroup : <EOL> setattr ( portgroup , key , db_portgroup [ key ] ) <EOL> return portgroup <EOL> def create_test_portgroup ( ctxt , ** kw ) : <EOL> """<STR_LIT>""" <EOL> portgroup = get_test_portgroup ( ctxt , ** kw ) <EOL> portgroup . create ( ) <EOL> return portgroup </s>
