示例#1
0
  @Activate
  protected void activate() {
    appId = coreService.registerApplication("org.onosproject.cordvtn");
    ruleInstaller =
        new CordVtnRuleInstaller(
            appId,
            flowRuleService,
            deviceService,
            driverService,
            groupService,
            mastershipService,
            DEFAULT_TUNNEL);

    arpProxy = new CordVtnArpProxy(appId, packetService);
    packetService.addProcessor(packetProcessor, PacketProcessor.director(0));
    arpProxy.requestPacket();

    hostService.addListener(hostListener);
    hostProvider = hostProviderRegistry.register(this);

    configRegistry.registerConfigFactory(configFactory);
    configService.addListener(configListener);
    readConfiguration();

    log.info("Started");
  }
示例#2
0
 /** When receiving NeighborSolicitation, updates location and IP. */
 @Test
 public void testReceiveNs() {
   testProcessor.process(new TestNsPacketContext(DEV4));
   HostDescription descr = providerService.added;
   assertThat(descr.location(), is(LOCATION2));
   assertThat(descr.hwAddress(), is(MAC2));
   assertThat(descr.ipAddress().toArray()[0], is(IP_ADDRESS2));
   assertThat(descr.vlan(), is(VLAN));
 }
示例#3
0
 /** When receiving IPv4, updates location only. */
 @Test
 public void testReceiveIpv4() {
   testProcessor.process(new TestIpv4PacketContext(DEV1));
   HostDescription descr = providerService.added;
   assertThat(descr.location(), is(LOCATION));
   assertThat(descr.hwAddress(), is(MAC));
   assertThat(descr.ipAddress().size(), is(0));
   assertThat(descr.vlan(), is(VLAN));
 }
示例#4
0
  @Test
  public void removeHostByDeviceRemove() {
    provider.modified(CTX_FOR_REMOVE);
    testProcessor.process(new TestArpPacketContext(DEV1));
    testProcessor.process(new TestNaPacketContext(DEV4));

    Device device =
        new DefaultDevice(
            ProviderId.NONE, deviceId(DEV1), SWITCH, "m", "h", "s", "n", new ChassisId(0L));
    deviceService.listener.event(new DeviceEvent(DEVICE_REMOVED, device));
    assertEquals("incorrect remove count", 1, providerService.removeCount);

    device =
        new DefaultDevice(
            ProviderId.NONE, deviceId(DEV4), SWITCH, "m", "h", "s", "n", new ChassisId(0L));
    deviceService.listener.event(new DeviceEvent(DEVICE_REMOVED, device));
    assertEquals("incorrect remove count", 2, providerService.removeCount);
  }
示例#5
0
  private void enable() {
    hostService.addListener(hostListener);
    packetService.addProcessor(packetProcessor, PacketProcessor.director(3));

    TrafficSelector selector =
        DefaultTrafficSelector.builder()
            .matchEthType(EthType.EtherType.IPV4.ethType().toShort())
            .build();
    packetService.requestPackets(selector, PacketPriority.REACTIVE, appId, Optional.empty());
  }
示例#6
0
  @Test
  public void events() {
    // new host
    testProcessor.process(new TestArpPacketContext(DEV1));
    assertNotNull("new host expected", providerService.added);
    assertNull("host motion unexpected", providerService.moved);

    // the host moved to new switch
    testProcessor.process(new TestArpPacketContext(DEV2));
    assertNotNull("host motion expected", providerService.moved);

    // the host was misheard on a spine
    testProcessor.process(new TestArpPacketContext(DEV3));
    assertNull("host misheard on spine switch", providerService.spine);

    providerService.clear();

    // new host
    testProcessor.process(new TestNaPacketContext(DEV4));
    assertNotNull("new host expected", providerService.added);
    assertNull("host motion unexpected", providerService.moved);

    // the host moved to new switch
    testProcessor.process(new TestNaPacketContext(DEV5));
    assertNotNull("host motion expected", providerService.moved);

    // the host was misheard on a spine
    testProcessor.process(new TestNaPacketContext(DEV6));
    assertNull("host misheard on spine switch", providerService.spine);
  }
  @Activate
  protected void activate() {
    appId = coreService.registerApplication("org.onosproject.openstackswitching");

    factories.forEach(cfgService::registerConfigFactory);
    packetService.addProcessor(internalPacketProcessor, PacketProcessor.director(1));
    deviceService.addListener(internalDeviceListener);
    cfgService.addListener(internalConfigListener);

    internalConfigListener.configureNetwork();

    log.info("Started");
  }
示例#8
0
  @Test
  public void removeHostByDevicePortDown() {
    provider.modified(CTX_FOR_REMOVE);
    testProcessor.process(new TestArpPacketContext(DEV1));
    testProcessor.process(new TestArpPacketContext(DEV4));

    Device device =
        new DefaultDevice(
            ProviderId.NONE, deviceId(DEV1), SWITCH, "m", "h", "s", "n", new ChassisId(0L));
    deviceService.listener.event(
        new DeviceEvent(PORT_UPDATED, device, new DefaultPort(device, portNumber(INPORT), false)));
    assertEquals("incorrect remove count", 1, providerService.removeCount);

    device =
        new DefaultDevice(
            ProviderId.NONE, deviceId(DEV4), SWITCH, "m", "h", "s", "n", new ChassisId(0L));
    deviceService.listener.event(
        new DeviceEvent(PORT_UPDATED, device, new DefaultPort(device, portNumber(INPORT), false)));
    assertEquals("incorrect remove count", 2, providerService.removeCount);
  }
  /**
   * Create a variable of the SwitchPacketProcessor class using the PacketProcessor defined above.
   * Activates the app.
   */
  @Activate
  protected void activate() {
    log.info("Started");
    appId =
        coreService.getAppId(
            "org.onosproject.learningswitch"); // equal to the name shown in pom.xml file

    processor = new SwitchPacketProcesser();
    packetService.addProcessor(processor, PacketProcessor.director(3));

    /*
     * Restricts packet types to IPV4 and ARP by only requesting those types.
     */
    packetService.requestPackets(
        DefaultTrafficSelector.builder().matchEthType(Ethernet.TYPE_IPV4).build(),
        PacketPriority.REACTIVE,
        appId,
        Optional.empty());
    packetService.requestPackets(
        DefaultTrafficSelector.builder().matchEthType(Ethernet.TYPE_ARP).build(),
        PacketPriority.REACTIVE,
        appId,
        Optional.empty());
  }
示例#10
0
 /** When receiving IPv6 multicast packet, ignores it. */
 @Test
 public void testReceiveIpv6Multicast() {
   testProcessor.process(new TestIpv6McastPacketContext(DEV4));
   assertNull(providerService.added);
 }
示例#11
0
 /** When receiving Duplicate Address Detection (DAD), ignores it. */
 @Test
 public void testReceiveDad() {
   testProcessor.process(new TestDadPacketContext(DEV4));
   assertNull(providerService.added);
 }