Examples of OFPhysicalPort


Examples of org.openflow.protocol.OFPhysicalPort

            PortSpeed.max(maxSpeed, f.getSpeed());
        return maxSpeed;
    }

    public OFPhysicalPort toOFPhysicalPort() {
        OFPhysicalPort ofpp = new OFPhysicalPort();
        ofpp.setPortNumber(this.getPortNumber());
        ofpp.setHardwareAddress(this.getHardwareAddress());
        ofpp.setName(this.getName());
        ofpp.setConfig(EnumBitmaps.toBitmap(this.getConfig()));
        int state = this.getStpState().getValue();
        if (this.isLinkDown())
            state |= OFPortState.OFPPS_LINK_DOWN.getValue();
        ofpp.setState(state);
        ofpp.setCurrentFeatures(EnumBitmaps.toBitmap(this.getCurrentFeatures()));
        ofpp.setAdvertisedFeatures(
                EnumBitmaps.toBitmap(this.getAdvertisedFeatures()));
        ofpp.setSupportedFeatures(
                EnumBitmaps.toBitmap(this.getSupportedFeatures()));
        ofpp.setPeerFeatures(EnumBitmaps.toBitmap(this.getPeerFeatures()));
        return ofpp;
    }
View Full Code Here

Examples of org.openflow.protocol.OFPhysicalPort

            rv.peerFeatures = EnumBitmaps.toBitmap(p.getPeerFeatures());
            return rv;
        }

        public OFPhysicalPort toOFPhysicalPort() {
            OFPhysicalPort p = new OFPhysicalPort();
            p.setPortNumber(portNumber);
            p.setHardwareAddress(MACAddress.valueOf(hardwareAddress).toBytes());
            p.setName(name);
            p.setConfig(config);
            p.setState(state);
            p.setCurrentFeatures(currentFeatures);
            p.setAdvertisedFeatures(advertisedFeatures);
            p.setSupportedFeatures(supportedFeatures);
            p.setPeerFeatures(peerFeatures);
            return p;
        }
View Full Code Here

Examples of org.openflow.protocol.OFPhysicalPort

    public void testSanity() throws Exception {
      assertTrue(true);
    }

    public static OFPhysicalPort createOFPhysicalPort(String name, int number) {
        OFPhysicalPort p = new OFPhysicalPort();
        p.setHardwareAddress(new byte [] { 0, 0, 0, 0, 0, 0 });
        p.setPortNumber((short)number);
        p.setName(name);
        return p;
    }
View Full Code Here

Examples of org.openflow.protocol.OFPhysicalPort

        UpdateOperation operation;

        IOFSwitch iofSwitch = floodlightProvider.getSwitch(sw);
        if (iofSwitch == null) return;

        OFPhysicalPort ofp = iofSwitch.getPort(port).toOFPhysicalPort();
        if (ofp == null) return;

        int srcPortState = ofp.getState();
        boolean portUp = ((srcPortState & OFPortState.OFPPS_STP_MASK.getValue())
                               != OFPortState.OFPPS_STP_BLOCK.getValue());

        if (portUp)
            operation = UpdateOperation.PORT_UP;
View Full Code Here

Examples of org.openflow.protocol.OFPhysicalPort

        // Takes care of all checks including null pointer checks.
        if (!isOutgoingDiscoveryAllowed(sw, port, isStandard, isReverse))
            return;

        IOFSwitch iofSwitch = floodlightProvider.getSwitch(sw);
        OFPhysicalPort ofpPort = iofSwitch.getPort(port).toOFPhysicalPort();

        if (log.isTraceEnabled()) {
            log.trace("Sending LLDP packet out of swich: {}, port: {}",
                      HexString.toHexString(sw), port);
        }
View Full Code Here

Examples of org.openflow.protocol.OFPhysicalPort

    public void testSwitchAdded() throws Exception {
        LinkDiscoveryManager linkDiscovery = getLinkDiscoveryManager();
        Capture<OFMessage> wc;
        Capture<FloodlightContext> fc;
        Set<Short> qPorts;
        OFPhysicalPort ofpp = new OFPhysicalPort();
        ofpp.setName("eth4242");
        ofpp.setPortNumber((short)4242);
        ofpp.setHardwareAddress(HexString.fromHexString("5c:16:c7:00:00:01"));
        ofpp.setCurrentFeatures(0);
        ImmutablePort p1 = ImmutablePort.fromOFPhysicalPort(ofpp);
        IOFSwitch sw1 = createMockSwitch(1L);

        // Set switch map in floodlightProvider.
        Map<Long, IOFSwitch> switches = new HashMap<Long, IOFSwitch>();
View Full Code Here

Examples of org.openflow.protocol.OFPhysicalPort

        featuresReply.setTables((byte)1);
        featuresReply.setCapabilities(3);
        featuresReply.setActions(4);
        List<OFPhysicalPort> ports = new ArrayList<OFPhysicalPort>();
        // A dummy port.
        OFPhysicalPort p = new OFPhysicalPort();
        p.setName("Eth1");
        p.setPortNumber((short)1);
        ports.add(p);
        featuresReply.setPorts(ports);
    }
View Full Code Here

Examples of org.openflow.protocol.OFPhysicalPort

    @Test
    public void testPortStatusMessageMaster() throws Exception {
        long dpid = featuresReply.getDatapathId();
        testInitialMoveToMasterWithRole();

        OFPhysicalPort p = new OFPhysicalPort();
        p.setName("Port1");
        p.setPortNumber((short)1);
        OFPortStatus ps = (OFPortStatus)
                BasicFactory.getInstance().getMessage(OFType.PORT_STATUS);
        ps.setDesc(p);

        // The events we expect sw.handlePortStatus to return
View Full Code Here

Examples of org.openflow.protocol.OFPhysicalPort

        // Switch 1
        // no actual IOFSwitch here because we simply add features reply
        // and desc stats to store
        OFFeaturesReply fr1a = createOFFeaturesReply();
        fr1a.setDatapathId(1L);
        OFPhysicalPort p = createOFPhysicalPort("P1", 1);
        ImmutablePort sw1p1 = ImmutablePort.fromOFPhysicalPort(p);
        List<OFPhysicalPort> ports1a = Collections.singletonList(p);
        fr1a.setPorts(ports1a);
        List<ImmutablePort> ports1aImmutable =
                ImmutablePort.immutablePortListOf(ports1a);
        // an alternative featuers reply
        OFFeaturesReply fr1b = createOFFeaturesReply();
        fr1b.setDatapathId(1L);
        p = new OFPhysicalPort();
        p = createOFPhysicalPort("P1", 1); // same port as above
        List<OFPhysicalPort> ports1b = new ArrayList<OFPhysicalPort>();
        ports1b.add(p);
        p = createOFPhysicalPort("P2", 42000);
        ImmutablePort sw1p2 = ImmutablePort.fromOFPhysicalPort(p);
        ports1b.add(p);
        fr1b.setPorts(ports1b);
        List<ImmutablePort> ports1bImmutable =
                ImmutablePort.immutablePortListOf(ports1b);

        // Switch 2
        // no actual IOFSwitch here because we simply add features reply
        // and desc stats to store
        OFFeaturesReply fr2a = createOFFeaturesReply();
        fr2a.setDatapathId(2L);
        ImmutablePort sw2p1 = sw1p1;
        List<OFPhysicalPort> ports2a = new ArrayList<OFPhysicalPort>(ports1a);
        fr2a.setPorts(ports2a);
        List<ImmutablePort> ports2aImmutable =
                ImmutablePort.immutablePortListOf(ports2a);
        // an alternative features reply
        OFFeaturesReply fr2b = createOFFeaturesReply();
        fr2b.setDatapathId(2L);
        p = new OFPhysicalPort();
        p = createOFPhysicalPort("P1", 2); // port number changed
        ImmutablePort sw2p1Changed = ImmutablePort.fromOFPhysicalPort(p);
        List<OFPhysicalPort> ports2b = Collections.singletonList(p);
        fr2b.setPorts(ports2b);
View Full Code Here

Examples of org.openflow.protocol.OFPhysicalPort

   public void testNotifySwitchPoArtChanged() throws Exception {
       long dpid = 42L;

       OFFeaturesReply fr1 = createOFFeaturesReply();
       fr1.setDatapathId(dpid);
       OFPhysicalPort p1 = createOFPhysicalPort("Port1", 1);
       fr1.setPorts(Collections.singletonList(p1));

       OFFeaturesReply fr2 = createOFFeaturesReply();
       fr1.setDatapathId(dpid);
       OFPhysicalPort p2 = createOFPhysicalPort("Port1", 1);
       p2.setAdvertisedFeatures(0x2); // just some bogus values
       fr2.setPorts(Collections.singletonList(p2));

       OFDescriptionStatistics desc = createOFDescriptionStatistics();

       // activate switch
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.