#NEWLINE# def test_create_ha_interfaces_binding_failure_rolls_back_ports( self ) : #NEWLINE# #INDENT# router = self . _create_router ( ) #NEWLINE# network = self . plugin . get_ha_network ( self . admin_ctx , router [ 'tenant_id' ] ) #NEWLINE# device_filter = { #NEWLINE# #INDENT# 'device_id' : [ router [ 'id' ] ] , #NEWLINE# #UNINDENT# } #NEWLINE# ports_before = self . core_plugin . get_ports ( self . admin_ctx , filters = device_filter ) #NEWLINE# router_db = self . plugin . _get_router ( self . admin_ctx , router [ 'id' ] ) #NEWLINE# with mock . patch . object ( l3_hamode_db , 'L3HARouterAgentPortBinding' , side_effect = ValueError ) : #NEWLINE# #INDENT# self . assertRaises ( ValueError , self . plugin . _create_ha_interfaces , self . admin_ctx , router_db , network ) #NEWLINE# #UNINDENT# ports_after = self . core_plugin . get_ports ( self . admin_ctx , filters = device_filter ) #NEWLINE# self . assertEqual ( ports_before , ports_after )