当前位置: 首页>>代码示例>>Java>>正文


Java VlanId.NONE属性代码示例

本文整理汇总了Java中org.onlab.packet.VlanId.NONE属性的典型用法代码示例。如果您正苦于以下问题:Java VlanId.NONE属性的具体用法?Java VlanId.NONE怎么用?Java VlanId.NONE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.onlab.packet.VlanId的用法示例。


在下文中一共展示了VlanId.NONE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUpInterfaceService

/**
 * Setup Interface expectation for all Testcases.
 **/
private void setUpInterfaceService() {
    Set<InterfaceIpAddress> interfaceIpAddresses1 = Sets.newHashSet();
    interfaceIpAddresses1
            .add(new InterfaceIpAddress(IpAddress.valueOf("192.168.10.101"), IpPrefix.valueOf("192.168.10.0/24")));
    Interface sw1Eth1 = new Interface(SW1_ETH1.deviceId().toString(), SW1_ETH1, interfaceIpAddresses1,
            MacAddress.valueOf("00:00:00:00:00:01"), VlanId.NONE);
    interfaces.add(sw1Eth1);

    Set<InterfaceIpAddress> interfaceIpAddresses2 = Sets.newHashSet();
    interfaceIpAddresses2
            .add(new InterfaceIpAddress(IpAddress.valueOf("192.168.20.101"), IpPrefix.valueOf("192.168.20.0/24")));
    Interface sw1Eth2 = new Interface(SW1_ETH1.deviceId().toString(), SW1_ETH2, interfaceIpAddresses2,
            MacAddress.valueOf("00:00:00:00:00:02"), VlanId.NONE);
    interfaces.add(sw1Eth2);

    Set<InterfaceIpAddress> interfaceIpAddresses3 = Sets.newHashSet();
    interfaceIpAddresses3
            .add(new InterfaceIpAddress(IpAddress.valueOf("192.168.30.101"), IpPrefix.valueOf("192.168.30.0/24")));
    Interface sw1Eth3 = new Interface(SW1_ETH1.deviceId().toString(), SW1_ETH3, interfaceIpAddresses3,
            MacAddress.valueOf("00:00:00:00:00:03"), VlanId.NONE);
    interfaces.add(sw1Eth3);

}
 
开发者ID:shlee89,项目名称:athena,代码行数:26,代码来源:ControlPlaneRedirectManagerTest.java

示例2: execute

@Override
protected void execute() {
    InterfaceAdminService interfaceService = get(InterfaceAdminService.class);

    List<InterfaceIpAddress> ipAddresses = Lists.newArrayList();
    if (ips != null) {
        for (String strIp : ips) {
            ipAddresses.add(InterfaceIpAddress.valueOf(strIp));
        }
    }

    MacAddress macAddr = mac == null ? null : MacAddress.valueOf(mac);

    VlanId vlanId = vlan == null ? VlanId.NONE : VlanId.vlanId(Short.parseShort(vlan));

    Interface intf = new Interface(name,
            ConnectPoint.deviceConnectPoint(connectPoint),
            ipAddresses, macAddr, vlanId);

    interfaceService.add(intf);

    print("Interface added");
}
 
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:InterfaceAddCommand.java

示例3: updateOspfForwarding

/**
 * Installs or removes OSPF forwarding rules.
 *
 * @param intf the interface on which event is received
 * @param install true to create an add objective, false to create a remove
 *            objective
 **/
private void updateOspfForwarding(Interface intf, boolean install) {
    // OSPF to router
    TrafficSelector toSelector = DefaultTrafficSelector.builder()
            .matchInPort(intf.connectPoint().port())
            .matchEthType(EthType.EtherType.IPV4.ethType().toShort())
            .matchVlanId(intf.vlan())
            .matchIPProtocol((byte) OSPF_IP_PROTO)
            .build();

    // create nextObjectives for forwarding to the controlPlaneConnectPoint
    DeviceId deviceId = controlPlaneConnectPoint.deviceId();
    PortNumber controlPlanePort = controlPlaneConnectPoint.port();
    int cpNextId;
    if (intf.vlan() == VlanId.NONE) {
        cpNextId = modifyNextObjective(deviceId, controlPlanePort,
                       VlanId.vlanId(SingleSwitchFibInstaller.ASSIGNED_VLAN),
                       true, install);
    } else {
        cpNextId = modifyNextObjective(deviceId, controlPlanePort,
                                       intf.vlan(), false, install);
    }
    log.debug("OSPF flows intf:{} nextid:{}", intf, cpNextId);
    flowObjectiveService.forward(controlPlaneConnectPoint.deviceId(),
            buildForwardingObjective(toSelector, null, cpNextId, install ? ospfEnabled : install));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:32,代码来源:ControlPlaneRedirectManager.java

示例4: testUpdateNetworkConfig

/**
 * Tests adding while updating the networkConfig.
 */
@Test
public void testUpdateNetworkConfig() {
    ConnectPoint sw1eth4 = new ConnectPoint(DEVICE_ID, PortNumber.portNumber(4));
    Set<InterfaceIpAddress> interfaceIpAddresses4 = Sets.newHashSet();
    interfaceIpAddresses4
            .add(new InterfaceIpAddress(IpAddress.valueOf("192.168.40.101"), IpPrefix.valueOf("192.168.40.0/24")));

    Interface sw1Eth4 = new Interface(sw1eth4.deviceId().toString(), sw1eth4, interfaceIpAddresses4,
            MacAddress.valueOf("00:00:00:00:00:04"), VlanId.NONE);
    interfaces.add(sw1Eth4);
    EasyMock.reset(flowObjectiveService);
    setUpFlowObjectiveService();
    networkConfigListener
            .event(new NetworkConfigEvent(Type.CONFIG_UPDATED, dev3, RoutingService.ROUTER_CONFIG_CLASS));
    networkConfigService.addListener(networkConfigListener);
    verify(flowObjectiveService);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:ControlPlaneRedirectManagerTest.java

示例5: testAddInterface

/**
 * Tests adding while updating the networkConfig.
 */
@Test
public void testAddInterface() {
    ConnectPoint sw1eth4 = new ConnectPoint(DEVICE_ID, PortNumber.portNumber(4));
    Set<InterfaceIpAddress> interfaceIpAddresses4 = Sets.newHashSet();
    interfaceIpAddresses4
            .add(new InterfaceIpAddress(IpAddress.valueOf("192.168.40.101"), IpPrefix.valueOf("192.168.40.0/24")));

    Interface sw1Eth4 = new Interface(sw1eth4.deviceId().toString(), sw1eth4, interfaceIpAddresses4,
            MacAddress.valueOf("00:00:00:00:00:04"), VlanId.NONE);
    interfaces.add(sw1Eth4);

    EasyMock.reset(flowObjectiveService);
    expect(flowObjectiveService.allocateNextId()).andReturn(1).anyTimes();

    setUpInterfaceConfiguration(sw1Eth4, true);
    replay(flowObjectiveService);
    interfaceListener.event(new InterfaceEvent(InterfaceEvent.Type.INTERFACE_ADDED, sw1Eth4, 500L));
    verify(flowObjectiveService);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:22,代码来源:ControlPlaneRedirectManagerTest.java

示例6: processVlanIdFilter

protected List<FlowRule> processVlanIdFilter(VlanIdCriterion vlanIdCriterion,
                                             FilteringObjective filt,
                                             VlanId assignedVlan,
                                             ApplicationId applicationId) {
    List<FlowRule> rules = new ArrayList<>();
    log.debug("adding rule for VLAN: {}", vlanIdCriterion.vlanId());
    TrafficSelector.Builder selector = DefaultTrafficSelector
            .builder();
    TrafficTreatment.Builder treatment = DefaultTrafficTreatment
            .builder();
    PortCriterion p = (PortCriterion) filt.key();
    if (vlanIdCriterion.vlanId() != VlanId.NONE) {
        selector.matchVlanId(vlanIdCriterion.vlanId());
        selector.matchInPort(p.port());
    } else {
        selector.matchInPort(p.port());
        treatment.immediate().pushVlan().setVlanId(assignedVlan);
    }
    treatment.transition(tmacTableId);
    FlowRule rule = DefaultFlowRule.builder().forDevice(deviceId)
            .withSelector(selector.build())
            .withTreatment(treatment.build())
            .withPriority(filt.priority()).fromApp(applicationId)
            .makePermanent().forTable(vlanTableId).build();
    rules.add(rule);

    return rules;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:28,代码来源:SpringOpenTTP.java

示例7: Interface

/**
 * Creates new Interface with the provided configuration.
 *
 * @param name name of the interface
 * @param connectPoint the connect point this interface maps to
 * @param ipAddresses list of IP addresses
 * @param macAddress MAC address
 * @param vlan VLAN ID
 */
public Interface(String name, ConnectPoint connectPoint,
                 List<InterfaceIpAddress> ipAddresses,
                 MacAddress macAddress, VlanId vlan) {
    this.name = name == null ? NO_INTERFACE_NAME : name;
    this.connectPoint = checkNotNull(connectPoint);
    this.ipAddresses = ipAddresses == null ? Lists.newArrayList() : ipAddresses;
    this.macAddress = macAddress == null ? MacAddress.NONE : macAddress;
    this.vlan = vlan == null ? VlanId.NONE : vlan;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:Interface.java

示例8: getVlan

private VlanId getVlan(JsonNode node) {
    VlanId vlan = VlanId.NONE;
    if (!node.path(VLAN).isMissingNode()) {
        vlan = VlanId.vlanId(node.path(VLAN).asText());
    }
    return vlan;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:7,代码来源:BgpConfig.java

示例9: ingressVlan

/**
 * Gets ingress VLAN of multicast traffic.
 *
 * @return Ingress VLAN ID
 */
public VlanId ingressVlan() {
    if (!object.has(INGRESS_VLAN)) {
        return VlanId.NONE;
    }

    try {
        return VlanId.vlanId(object.path(INGRESS_VLAN).asText());
    } catch (IllegalArgumentException e) {
        return null;
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:16,代码来源:McastConfig.java

示例10: egressVlan

/**
 * Gets egress VLAN of multicast traffic.
 *
 * @return Egress VLAN ID
 */
public VlanId egressVlan() {
    if (!object.has(EGRESS_VLAN)) {
        return VlanId.NONE;
    }

    try {
        return VlanId.vlanId(object.path(EGRESS_VLAN).asText());
    } catch (IllegalArgumentException e) {
        return null;
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:16,代码来源:McastConfig.java

示例11: addIntfConfig

/**
 * Creates the interface configuration. On devices 1, 2 and 3 is configured
 * an interface on port 1 with vlan 1. On devices 4, 5 and 6 is configured
 * an interface on port 1 with vlan 2. On device 5 no interfaces are
 * configured.
 */
private void addIntfConfig() {
    Set<Interface> interfaces = Sets.newHashSet();
    Set<Interface> vlanOneSet = Sets.newHashSet();
    Set<Interface> vlanTwoSet = Sets.newHashSet();

    for (int i = 1; i <= NUM_DEVICES - 1; i++) {
        ConnectPoint cp = new ConnectPoint(getDeviceId(i), P1);

        Interface intf =
                new Interface("intfOne", cp, Collections.emptyList(), null,
                              VlanId.NONE);

        if (i <= 3) {
            intf = new Interface("intfTwo", cp, Collections.emptyList(),
                                 null, VLAN1);
            interfaces.add(intf);
            vlanOneSet.add(intf);
        } else if (i > 3 && i <= 6) {
            intf = new Interface("intfThree", cp, Collections.emptyList(),
                                 null, VLAN2);
            interfaces.add(intf);
            vlanTwoSet.add(intf);
        }
        expect(interfaceService.getInterfacesByPort(cp))
                .andReturn(Sets.newHashSet(intf)).anyTimes();
    }
    expect(interfaceService.getInterfacesByVlan(VLAN1))
            .andReturn(vlanOneSet).anyTimes();
    expect(interfaceService.getInterfacesByVlan(VLAN2))
            .andReturn(vlanTwoSet).anyTimes();
    expect(interfaceService.getInterfaces()).andReturn(interfaces).anyTimes();

    replay(interfaceService);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:40,代码来源:VplsTest.java

示例12: createHost

private Host createHost(MacAddress macAddress, ConnectPoint location) {
    return new DefaultHost(
            new ProviderId("host", "org.onosproject.segmentrouting"),
            HostId.hostId(macAddress),
            macAddress,
            VlanId.NONE,
            new HostLocation(location, System.currentTimeMillis()),
            ImmutableSet.of());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:9,代码来源:CordConfigHandler.java

示例13: getHost

@Override
public Host getHost(HostId hostId) {
    ProviderId providerId = ProviderId.NONE;
    MacAddress mac =  MacAddress.valueOf("fa:12:3e:56:ee:a2");
    VlanId vlan = VlanId.NONE;
    HostLocation location =  HostLocation.NONE;
    Set<IpAddress> ips = Sets.newHashSet();
    Annotations annotations = null;
    return new DefaultHost(providerId, hostId, mac, vlan, location, ips, annotations);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:HostServiceAdapter.java

示例14: setUpInterfaceService

/**
 * Sets up the interface service.
 */
private void setUpInterfaceService() {
    List<InterfaceIpAddress> interfaceIpAddresses1 = Lists.newArrayList();
    interfaceIpAddresses1.add(InterfaceIpAddress.valueOf("192.168.10.101/24"));
    Interface sw1Eth1 = new Interface("sw1-eth1", SW1_ETH1,
                                      interfaceIpAddresses1, MacAddress.valueOf("00:00:00:00:00:01"),
                                      VlanId.NONE);
    interfaces.add(sw1Eth1);

    List<InterfaceIpAddress> interfaceIpAddresses2 = Lists.newArrayList();
    interfaceIpAddresses2.add(InterfaceIpAddress.valueOf("192.168.20.101/24"));
    Interface sw2Eth1 = new Interface("sw2-eth1", SW2_ETH1,
                                      interfaceIpAddresses2, MacAddress.valueOf("00:00:00:00:00:02"),
                                      VlanId.NONE);
    interfaces.add(sw2Eth1);

    InterfaceIpAddress interfaceIpAddress3 = InterfaceIpAddress.valueOf("192.168.30.101/24");
    Interface sw3Eth1 = new Interface("sw3-eth1", SW3_ETH1,
                                      Lists.newArrayList(interfaceIpAddress3),
                                      MacAddress.valueOf("00:00:00:00:00:03"),
                                      VlanId.vlanId((short) 1));
    interfaces.add(sw3Eth1);

    expect(interfaceService.getInterfacesByPort(SW1_ETH1)).andReturn(
            Collections.singleton(sw1Eth1)).anyTimes();
    expect(interfaceService.getMatchingInterface(Ip4Address.valueOf("192.168.10.1")))
            .andReturn(sw1Eth1).anyTimes();
    expect(interfaceService.getInterfacesByPort(SW2_ETH1)).andReturn(
            Collections.singleton(sw2Eth1)).anyTimes();
    expect(interfaceService.getMatchingInterface(Ip4Address.valueOf("192.168.20.1")))
            .andReturn(sw2Eth1).anyTimes();
    expect(interfaceService.getInterfacesByPort(SW3_ETH1)).andReturn(
            Collections.singleton(sw3Eth1)).anyTimes();
    expect(interfaceService.getMatchingInterface(Ip4Address.valueOf("192.168.30.1")))
            .andReturn(sw3Eth1).anyTimes();
    expect(interfaceService.getInterfaces()).andReturn(interfaces).anyTimes();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:39,代码来源:SdnIpFibNoVlanstoVlanTest.java

示例15: setUpInterfaceService

/**
 * Sets up the interface service.
 */
private void setUpInterfaceService() {
    List<InterfaceIpAddress> interfaceIpAddresses1 = Lists.newArrayList();
    interfaceIpAddresses1.add(InterfaceIpAddress.valueOf("192.168.10.101/24"));
    Interface sw1Eth1 = new Interface("sw1-eth1", SW1_ETH1,
                                      interfaceIpAddresses1, MacAddress.valueOf("00:00:00:00:00:01"),
                                      VlanId.vlanId((short) 1));
    interfaces.add(sw1Eth1);

    List<InterfaceIpAddress> interfaceIpAddresses2 = Lists.newArrayList();
    interfaceIpAddresses2.add(InterfaceIpAddress.valueOf("192.168.20.101/24"));
    Interface sw2Eth1 = new Interface("sw2-eth1", SW2_ETH1,
                                      interfaceIpAddresses2, MacAddress.valueOf("00:00:00:00:00:02"),
                                      VlanId.vlanId((short) 1));
    interfaces.add(sw2Eth1);

    InterfaceIpAddress interfaceIpAddress3 = InterfaceIpAddress.valueOf("192.168.30.101/24");
    Interface sw3Eth1 = new Interface("sw3-eth1", SW3_ETH1,
                                      Lists.newArrayList(interfaceIpAddress3),
                                      MacAddress.valueOf("00:00:00:00:00:03"),
                                      VlanId.NONE);
    interfaces.add(sw3Eth1);

    expect(interfaceService.getInterfacesByPort(SW1_ETH1)).andReturn(
            Collections.singleton(sw1Eth1)).anyTimes();
    expect(interfaceService.getMatchingInterface(Ip4Address.valueOf("192.168.10.1")))
            .andReturn(sw1Eth1).anyTimes();
    expect(interfaceService.getInterfacesByPort(SW2_ETH1)).andReturn(
            Collections.singleton(sw2Eth1)).anyTimes();
    expect(interfaceService.getMatchingInterface(Ip4Address.valueOf("192.168.20.1")))
            .andReturn(sw2Eth1).anyTimes();
    expect(interfaceService.getInterfacesByPort(SW3_ETH1)).andReturn(
            Collections.singleton(sw3Eth1)).anyTimes();
    expect(interfaceService.getMatchingInterface(Ip4Address.valueOf("192.168.30.1")))
            .andReturn(sw3Eth1).anyTimes();
    expect(interfaceService.getInterfaces()).andReturn(interfaces).anyTimes();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:39,代码来源:SdnIpFibVlanstoNoVlanTest.java


注:本文中的org.onlab.packet.VlanId.NONE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。