<s> import mock <EOL> import neutron . plugins . ml2 . drivers . openvswitch . agent . common . constants as ovs_const <EOL> from neutron . tests . unit . plugins . ml2 . drivers . openvswitch . agent . openflow . ovs_ofctl import ovs_bridge_test_base <EOL> call = mock . call <EOL> class OVSPhysicalBridgeTest ( ovs_bridge_test_base . OVSBridgeTestBase , <EOL> ovs_bridge_test_base . OVSDVRProcessTestMixin ) : <EOL> dvr_process_table_id = ovs_const . DVR_PROCESS_VLAN <EOL> dvr_process_next_table_id = ovs_const . LOCAL_VLAN_TRANSLATION <EOL> def setUp ( self ) : <EOL> super ( OVSPhysicalBridgeTest , self ) . setUp ( ) <EOL> self . setup_bridge_mock ( '<STR_LIT>' , self . br_phys_cls ) <EOL> def test_setup_default_table ( self ) : <EOL> self . br . setup_default_table ( ) <EOL> expected = [ <EOL> call . add_flow ( priority = <NUM_LIT:0> , table = <NUM_LIT:0> , actions = '<STR_LIT>' ) , <EOL> ] <EOL> self . assertEqual ( expected , self . mock . mock_calls ) <EOL> def test_provision_local_vlan ( self ) : <EOL> port = <NUM_LIT> <EOL> lvid = <NUM_LIT> <EOL> segmentation_id = <NUM_LIT> <EOL> distributed = False <EOL> self . br . provision_local_vlan ( port = port , lvid = lvid , <EOL> segmentation_id = segmentation_id , <EOL> distributed = distributed ) <EOL> expected = [ <EOL> call . add_flow ( priority = <NUM_LIT:4> , table = <NUM_LIT:0> , dl_vlan = lvid , in_port = port , <EOL> actions = '<STR_LIT>' % segmentation_id ) , <EOL> ] <EOL> self . assertEqual ( expected , self . mock . mock_calls ) <EOL> def test_provision_local_vlan_novlan ( self ) : <EOL> port = <NUM_LIT> <EOL> lvid = <NUM_LIT> <EOL> segmentation_id = None <EOL> distributed = False <EOL> self . br . provision_local_vlan ( port = port , lvid = lvid , <EOL> segmentation_id = segmentation_id , <EOL> distributed = distributed ) <EOL> expected = [ <EOL> call . add_flow ( priority = <NUM_LIT:4> , table = <NUM_LIT:0> , dl_vlan = lvid , in_port = port , <EOL> actions = '<STR_LIT>' ) <EOL> ] <EOL> self . assertEqual ( expected , self . mock . mock_calls ) <EOL> def test_reclaim_local_vlan ( self ) : <EOL> port = <NUM_LIT> <EOL> lvid = <NUM_LIT> <EOL> self . br . reclaim_local_vlan ( port = port , lvid = lvid ) <EOL> expected = [ <EOL> call . delete_flows ( dl_vlan = lvid , in_port = port ) , <EOL> ] <EOL> self . assertEqual ( expected , self . mock . mock_calls ) <EOL> def test_add_dvr_mac_vlan ( self ) : <EOL> mac = '<STR_LIT>' <EOL> port = <NUM_LIT> <EOL> self . br . add_dvr_mac_vlan ( mac = mac , port = port ) <EOL> expected = [ <EOL> call . add_flow ( priority = <NUM_LIT:2> , table = <NUM_LIT:3> , dl_src = mac , <EOL> actions = '<STR_LIT>' % port ) , <EOL> ] <EOL> self . assertEqual ( expected , self . mock . mock_calls ) <EOL> def test_remove_dvr_mac_vlan ( self ) : <EOL> mac = '<STR_LIT>' <EOL> self . br . remove_dvr_mac_vlan ( mac = mac ) <EOL> expected = [ <EOL> call . delete_flows ( eth_src = mac , table_id = <NUM_LIT:3> ) , <EOL> ] <EOL> self . assertEqual ( expected , self . mock . mock_calls ) </s>
