#NEWLINE# def _create_or_update_chain( self , context , provider , consumer , spec_id , parent_spec_id , classifier_id , hierarchial_classifier_mismatch , prs_id ) : #NEWLINE# #INDENT# ptg_chain_map = self . _get_ptg_servicechain_mapping ( context . _plugin_context . session , provider ) #NEWLINE# if ptg_chain_map : #NEWLINE# #INDENT# if ( hierarchial_classifier_mismatch or ( not spec_id ) ) : #NEWLINE# #INDENT# ctx = self . _get_chain_admin_context ( context . _plugin_context , tenant_id = ptg_chain_map [ 0 ] . tenant_id ) #NEWLINE# self . _delete_servicechain_instance ( ctx , ptg_chain_map [ 0 ] . servicechain_instance_id ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# sc_specs = [ spec_id ] #NEWLINE# if parent_spec_id : #NEWLINE# #INDENT# sc_specs . insert ( 0 , parent_spec_id ) #NEWLINE# #UNINDENT# self . _update_servicechain_instance ( context . _plugin_context , provider [ 0 ] . servicechain_instance_id , classifier_id = classifier_id , sc_specs = sc_specs ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( spec_id and ( not hierarchial_classifier_mismatch ) ) : #NEWLINE# #INDENT# self . _create_servicechain_instance ( context , spec_id , parent_spec_id , provider , SCI_CONSUMER_NOT_AVAILABLE , classifier_id , prs_id )