def test_prepare_pop_flow(self): """Test prepare pop flow method.""" attributes = { "controller": get_controller_mock(), "name": "custom_name", "uni_a": get_uni_mocked(interface_port=1, is_valid=True), "uni_z": get_uni_mocked(interface_port=2, is_valid=True), } evc = EVC(**attributes) interface_a = evc.uni_a.interface interface_z = evc.uni_z.interface in_vlan = 10 # pylint: disable=protected-access flow_mod = evc._prepare_pop_flow(interface_a, interface_z, in_vlan) expected_flow_mod = { 'match': { 'in_port': interface_a.port_number, 'dl_vlan': in_vlan }, 'cookie': evc.get_cookie(), 'actions': [{ 'action_type': 'pop_vlan' }, { 'action_type': 'output', 'port': interface_z.port_number }] } self.assertEqual(expected_flow_mod, flow_mod)
def test_prepare_pop_flow(self): """Test prepare pop flow method.""" attributes = { "controller": get_controller_mock(), "name": "custom_name", "uni_a": get_uni_mocked(interface_port=1, is_valid=True), "uni_z": get_uni_mocked(interface_port=2, is_valid=True), } evc = EVC(**attributes) interface_a = evc.uni_a.interface interface_z = evc.uni_z.interface in_vlan = 10 # pylint: disable=protected-access flow_mod = evc._prepare_pop_flow(interface_a, interface_z, None, in_vlan) expected_flow_mod = { "match": { "in_port": interface_a.port_number, "dl_vlan": in_vlan }, "cookie": evc.get_cookie(), "actions": [ { "action_type": "pop_vlan" }, { "action_type": "output", "port": interface_z.port_number }, ], } self.assertEqual(expected_flow_mod, flow_mod)