Search in sources :

Example 11 with OFPortDesc

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());
    }
}
Also used : OFPortDesc(org.projectfloodlight.openflow.protocol.OFPortDesc) HashMap(java.util.HashMap) DatapathId(org.projectfloodlight.openflow.types.DatapathId) PortInfoData(org.openkilda.messaging.info.event.PortInfoData) Map(java.util.Map) HashMap(java.util.HashMap) Test(org.junit.Test)

Aggregations

OFPortDesc (org.projectfloodlight.openflow.protocol.OFPortDesc)11 InetSocketAddress (java.net.InetSocketAddress)5 IOFSwitch (net.floodlightcontroller.core.IOFSwitch)4 DatapathId (org.projectfloodlight.openflow.types.DatapathId)4 FloodlightModuleContext (net.floodlightcontroller.core.module.FloodlightModuleContext)3 Before (org.junit.Before)3 InfoMessage (org.openkilda.messaging.info.InfoMessage)3 JWTVerificationException (com.auth0.jwt.exceptions.JWTVerificationException)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 ByteBuffer (java.nio.ByteBuffer)2 Map (java.util.Map)2 FloodlightModuleException (net.floodlightcontroller.core.module.FloodlightModuleException)2 Ethernet (net.floodlightcontroller.packet.Ethernet)2 LLDPTLV (net.floodlightcontroller.packet.LLDPTLV)2 Test (org.junit.Test)2 OFDescStatsReply (org.projectfloodlight.openflow.protocol.OFDescStatsReply)2 OFPortDescProp (org.projectfloodlight.openflow.protocol.OFPortDescProp)2 OFPortDescPropEthernet (org.projectfloodlight.openflow.protocol.OFPortDescPropEthernet)2 DecodedJWT (com.auth0.jwt.interfaces.DecodedJWT)1