use of org.projectfloodlight.openflow.protocol.OFPortDesc in project open-kilda by telstra.
the class OfPortDescConverterTest method testPortChangeTypeMapping.
@Test
public void testPortChangeTypeMapping() {
OFPortDesc portDesc = OFFactoryVer13.INSTANCE.buildPortDesc().setPortNo(OFPort.of(1)).setName("test").build();
Map<org.openkilda.messaging.info.event.PortChangeType, net.floodlightcontroller.core.PortChangeType> expected = new HashMap<>();
expected.put(org.openkilda.messaging.info.event.PortChangeType.ADD, net.floodlightcontroller.core.PortChangeType.ADD);
expected.put(org.openkilda.messaging.info.event.PortChangeType.OTHER_UPDATE, net.floodlightcontroller.core.PortChangeType.OTHER_UPDATE);
expected.put(org.openkilda.messaging.info.event.PortChangeType.DELETE, net.floodlightcontroller.core.PortChangeType.DELETE);
expected.put(org.openkilda.messaging.info.event.PortChangeType.UP, net.floodlightcontroller.core.PortChangeType.UP);
expected.put(org.openkilda.messaging.info.event.PortChangeType.DOWN, net.floodlightcontroller.core.PortChangeType.DOWN);
DatapathId dpId = DatapathId.of(1);
for (Map.Entry<org.openkilda.messaging.info.event.PortChangeType, net.floodlightcontroller.core.PortChangeType> entry : expected.entrySet()) {
PortInfoData encoded = OfPortDescConverter.INSTANCE.toPortInfoData(dpId, portDesc, entry.getValue());
Assert.assertSame(entry.getKey(), encoded.getState());
}
}
Aggregations