Java Code Examples for org.onosproject.net.DeviceId#deviceId()

The following examples show how to use org.onosproject.net.DeviceId#deviceId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DeviceInterfaceRemoveCommand.java    From onos with Apache License 2.0 6 votes vote down vote up
@Override
protected void doExecute() {
    DriverService service = get(DriverService.class);
    DeviceId deviceId = DeviceId.deviceId(uri);
    DriverHandler h = service.createHandler(deviceId);
    InterfaceConfig interfaceConfig = h.behaviour(InterfaceConfig.class);

    if (trunkMode && !accessMode && !rateLimit) {
        // Trunk mode for VLAN to be removed.
        removeTrunkModeFromIntf(interfaceConfig);
    } else if (accessMode && !trunkMode && !rateLimit) {
        // Access mode for VLAN to be removed.
        removeAccessModeFromIntf(interfaceConfig);
    } else if (rateLimit && !trunkMode && !accessMode) {
        // Rate limit to be removed.
        removeRateLimitFromIntf(interfaceConfig);
    } else {
        // Option has not been correctly set.
        print(ONE_ACTION_ALLOWED);
    }
}
 
Example 2
Source File: DeviceDiscoveryTest.java    From onos with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() {
    MockCoreService coreService = new MockCoreService(101, "org.onosproject.drivers.netconf",
            "org.onosproject.linkdiscovery", "org.onosproject.drivers.ciena.c5170");

    // Load the mock responses for mock device "netconf:1.2.3.4:830"
    DeviceId mId = DeviceId.deviceId("netconf:1.2.3.4:830");
    mockRequestDriver.load(DeviceDiscoveryTest.class, "/templates/responses/device_1_2_3_4/%s.j2", mId,
            "systemInfo", "softwareVersion", "logicalPorts", "link-info", "port-stats", "chassis-mac");
    MockDriverHandler mockDriverHandler = new MockDriverHandler(Ciena5170DriversLoader.class,
            "/ciena-5170-drivers.xml", mId, coreService, deviceService);
    NetconfController controller = mockDriverHandler.get(NetconfController.class);
    mockDriverHandlers.put(mId, mockDriverHandler);
    mockRequestDriver.setDeviceMap(controller.getDevicesMap());

    // Load the mock responses for mock device "netconf:5.6.7.8:830"
    mId = DeviceId.deviceId("netconf:5.6.7.8:830");
    mockRequestDriver.load(DeviceDiscoveryTest.class, "/templates/responses/device_5_6_7_8/%s.j2", mId,
            "systemInfo", "softwareVersion", "logicalPorts", "link-info", "chassis-mac");
    mockDriverHandler = new MockDriverHandler(Ciena5170DriversLoader.class, "/ciena-5170-drivers.xml", mId,
            coreService, deviceService);
    controller = mockDriverHandler.get(NetconfController.class);
    mockDriverHandlers.put(mId, mockDriverHandler);

    mockRequestDriver.setDeviceMap(controller.getDevicesMap());
}
 
Example 3
Source File: IsisTopologyProvider.java    From onos with Apache License 2.0 6 votes vote down vote up
@Override
public void routerAdded(IsisRouter isisRouter) {
    String systemId = isisRouter.systemId();
    log.info("Added device {}", systemId);
    DeviceId deviceId = DeviceId.deviceId(IsisRouterId.uri(systemId));
    Device.Type deviceType = Device.Type.ROUTER;
    //If our routerType is Dr or Bdr type is PSEUDO
    if (isisRouter.isDis()) {
        deviceType = Device.Type.ROUTER;
    } else {
        deviceType = Device.Type.VIRTUAL;
    }
    ChassisId cId = new ChassisId();
    DefaultAnnotations.Builder newBuilder = DefaultAnnotations.builder();
    newBuilder.set(AnnotationKeys.TYPE, "L3");
    newBuilder.set("RouterId", systemId);
    DeviceDescription description =
            new DefaultDeviceDescription(IsisRouterId.uri(systemId), deviceType, UNKNOWN, UNKNOWN, UNKNOWN,
                                         UNKNOWN, cId, newBuilder.build());
    deviceProviderService.deviceConnected(deviceId, description);
    System.out.println("Device added: " + systemId);
}
 
Example 4
Source File: VirtualPortCodec.java    From onos with Apache License 2.0 6 votes vote down vote up
@Override
public VirtualPort decode(ObjectNode json, CodecContext context) {
    if (json == null || !json.isObject()) {
        return null;
    }

    NetworkId nId = NetworkId.networkId(Long.parseLong(extractMember(NETWORK_ID, json)));
    DeviceId dId = DeviceId.deviceId(extractMember(DEVICE_ID, json));

    VirtualNetworkService vnetService = context.getService(VirtualNetworkService.class);
    Set<VirtualDevice> vDevs = vnetService.getVirtualDevices(nId);
    VirtualDevice vDev = vDevs.stream()
            .filter(virtualDevice -> virtualDevice.id().equals(dId))
            .findFirst().orElse(null);
    nullIsIllegal(vDev, dId.toString() + INVALID_VIRTUAL_DEVICE);

    PortNumber portNum = PortNumber.portNumber(extractMember(PORT_NUM, json));
    DeviceId physDId = DeviceId.deviceId(extractMember(PHYS_DEVICE_ID, json));
    PortNumber physPortNum = PortNumber.portNumber(extractMember(PHYS_PORT_NUM, json));

    ConnectPoint realizedBy = new ConnectPoint(physDId, physPortNum);
    return new DefaultVirtualPort(nId, vDev, portNum, realizedBy);
}
 
Example 5
Source File: LabelResourcePool.java    From onos with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a pool by device id,begin label id,end label id.
 * Used to update a pool in the store.
 *
 * @param deviceId device identifier
 * @param beginLabel represents for the first label id in the range of label
 *            resource pool
 * @param endLabel represents for the last label id in the range of label
 *            resource pool
 * @param totalNum capacity of label resource pool
 * @param usedNum have used label number
 * @param currentUsedMaxLabelId the maximal label number id
 * @param releaseLabelId Set of released label
 */
public LabelResourcePool(String deviceId, long beginLabel, long endLabel,
                         long totalNum, long usedNum,
                         long currentUsedMaxLabelId,
                         ImmutableSet<LabelResource> releaseLabelId) {
    checkArgument(endLabel >= beginLabel,
                  "endLabel %s must be greater than or equal to beginLabel %s",
                  endLabel, beginLabel);
    this.deviceId = DeviceId.deviceId(deviceId);
    this.beginLabel = LabelResourceId.labelResourceId(beginLabel);
    this.endLabel = LabelResourceId.labelResourceId(endLabel);
    this.totalNum = totalNum;
    this.usedNum = usedNum;
    this.currentUsedMaxLabelId = LabelResourceId
            .labelResourceId(currentUsedMaxLabelId);
    this.releaseLabelId = releaseLabelId;
}
 
Example 6
Source File: OpenFlowPacketProvider.java    From onos with Apache License 2.0 6 votes vote down vote up
@Override
public void handlePacket(OpenFlowPacketContext pktCtx) {
    DeviceId id = DeviceId.deviceId(Dpid.uri(pktCtx.dpid().value()));

    DefaultInboundPacket inPkt = new DefaultInboundPacket(
            new ConnectPoint(id, PortNumber.portNumber(pktCtx.inPort())),
            pktCtx.parsed(), ByteBuffer.wrap(pktCtx.unparsed()),
            pktCtx.cookie());

    DefaultOutboundPacket outPkt = null;
    if (!pktCtx.isBuffered()) {
        outPkt = new DefaultOutboundPacket(id, null,
                ByteBuffer.wrap(pktCtx.unparsed()));
    }

    OpenFlowCorePacketContext corePktCtx =
            new OpenFlowCorePacketContext(System.currentTimeMillis(),
                    inPkt, outPkt, pktCtx.isHandled(), pktCtx);
    providerService.processPacket(corePktCtx);
}
 
Example 7
Source File: RoadmPortViewMessageHandler.java    From onos with Apache License 2.0 6 votes vote down vote up
@Override
public void process(ObjectNode payload) {
    DeviceId did = DeviceId.deviceId(string(payload, RoadmUtil.DEV_ID));
    Type devType = deviceService.getDevice(did).type();
    // Build response
    ObjectNode node = objectNode();
    node.put(SHOW_FLOW_ICON, devType == Type.ROADM);
    if (devType == Type.FIBER_SWITCH) {
        node.put(SHOW_TARGET_POWER, false);
        node.put(SHOW_SERVICE_STATE, true);
        // add protection switch paths
        putProtectionSwitchPaths(did, node);
    } else {
        node.put(SHOW_TARGET_POWER, true);
        node.put(SHOW_SERVICE_STATE, false);
    }
    sendMessage(ROADM_SHOW_ITEMS_RESP, node);
}
 
Example 8
Source File: DecodeInstructionCodecHelper.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * Returns device identifier.
 *
 * @return device identifier
 * @throws IllegalArgumentException if the JSON is invalid
 */
private DeviceId getDeviceId() {
    JsonNode deviceIdNode = json.get(InstructionCodec.DEVICE_ID);
    if (deviceIdNode != null) {
        return DeviceId.deviceId(deviceIdNode.asText());
    }
    throw new IllegalArgumentException("Empty device identifier");
}
 
Example 9
Source File: NetconfGetConfigCommand.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
protected void doExecute() {
    deviceId = DeviceId.deviceId(uri);

    NetconfController controller = get(NetconfController.class);
    checkNotNull(controller, "Netconf controller is null");

    NetconfDevice device = controller.getDevicesMap().get(deviceId);
    if (device == null) {
        print("Netconf device object not found for %s", deviceId);
        return;
    }

    NetconfSession session = device.getSession();
    if (session == null) {
        print("Netconf session not found for %s", deviceId);
        return;
    }

    try {
        CharSequence res = session.asyncGetConfig(datastore(datastore.toLowerCase()))
                            .get(timeoutSec, TimeUnit.SECONDS);
        print("%s", res);
    } catch (NetconfException | InterruptedException | ExecutionException | TimeoutException e) {
        log.error("Configuration could not be retrieved", e);
        print("Error occurred retrieving configuration");
    }
}
 
Example 10
Source File: VirtualLinkCreateCommand.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
protected void doExecute() {
    VirtualNetworkAdminService service = get(VirtualNetworkAdminService.class);
    ConnectPoint src = new ConnectPoint(DeviceId.deviceId(srcDeviceId), PortNumber.portNumber(srcPortNum));
    ConnectPoint dst = new ConnectPoint(DeviceId.deviceId(dstDeviceId), PortNumber.portNumber(dstPortNum));

    service.createVirtualLink(NetworkId.networkId(networkId), src, dst);
    if (bidirectional) {
        service.createVirtualLink(NetworkId.networkId(networkId), dst, src);
    }
    print("Virtual link successfully created.");
}
 
Example 11
Source File: ResourceIdsTest.java    From onos with Apache License 2.0 5 votes vote down vote up
@Test
public void testFromInstanceIdentifier() {

    ResourceId eth0 = ResourceId.builder()
            .addBranchPointSchema("interfaces", "ietf-interfaces")
            .addBranchPointSchema("interface", "ietf-interfaces")
            .addKeyLeaf("name", "ietf-interfaces", "eth0")
            .build();
    assertThat(ResourceIds.fromInstanceIdentifier("/ietf-interfaces:interfaces/interface[name=\"eth0\"]"),
               is(eth0));

    assertThat("fromInstanceIdentifier return path relative to virtual root",
               ResourceIds.fromInstanceIdentifier("/org.onosproject.dcs:devices"),
               is(ResourceIds.relativize(ResourceIds.ROOT_ID, DEVICES_ID)));

    assertThat(ResourceIds.prefixDcsRoot(
                 ResourceIds.fromInstanceIdentifier("/org.onosproject.dcs:devices")),
               is(DEVICES_ID));

    assertThat(ResourceIds.fromInstanceIdentifier("/"),
                is(nullValue()));

    DeviceId deviceId = DeviceId.deviceId("test:device-identifier");
    assertThat(ResourceIds.prefixDcsRoot(
             fromInstanceIdentifier("/org.onosproject.dcs:devices/device[device-id=\"test:device-identifier\"]")),
               is(toResourceId(deviceId)));

}
 
Example 12
Source File: VoltSetNniLinkCommand.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
protected void doExecute() {
    DriverService service = get(DriverService.class);
    deviceId = DeviceId.deviceId(uri);
    DriverHandler h = service.createHandler(deviceId);
    VoltNniLinkConfig volt = h.behaviour(VoltNniLinkConfig.class);
    boolean reply = volt.setNniLink(target);
    if (!reply) {
        print("No reply from %s", deviceId.toString());
    }
}
 
Example 13
Source File: DistributedLabelResourceStore.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public boolean releaseToGlobalPool(Set<LabelResourceId> release) {
    Set<LabelResource> set = new HashSet<>();
    DefaultLabelResource resource = null;
    for (LabelResourceId labelResource : release) {
        resource = new DefaultLabelResource(DeviceId.deviceId(GLOBAL_RESOURCE_POOL_DEVICE_ID),
                                            labelResource);
        set.add(resource);
    }
    LabelResourceRequest request = new LabelResourceRequest(DeviceId.deviceId(GLOBAL_RESOURCE_POOL_DEVICE_ID),
                                                            LabelResourceRequest.Type.RELEASE,
                                                            0,
                                                            ImmutableSet.copyOf(set));
    return this.internalRelease(request);
}
 
Example 14
Source File: DefaultBuilder.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * Builds a sample abstract TE Topology, which consists of one abstract node
 * representing an entire physical network, one inter-domain link and one
 * TTP.
 *
 * @return value of network with an abstract TE Topology
 */
public static Network buildSampleAbstractNetwork() {
    TeTopologyKey underlayTopologyId = new TeTopologyKey(PROVIDER_ID,
                                                         CLIENT_NIL,
                                                         NATIVE_TOPOLOGY_ID);
    Map<KeyId, NetworkNode> nodes = Maps.newHashMap();
    networkNode = nodeBuilder(NODEIP, NUM_TPS, NUM_TTPS, underlayTopologyId,
                              null, null, ABSTRACT);
    nodes.put(networkNode.nodeId(), networkNode);

    Map<KeyId, NetworkLink> links = Maps.newHashMap();
    TeLinkTpKey node1tp1 = new TeLinkTpKey(networkNode.teNode().teNodeId(),
                                           networkNode.teNode()
                                                   .teTerminationPointIds()
                                                   .get(FIRST_INDEX));
    networkLink = linkBuilder(node1tp1, null, null, null, null, UNABSTRACT,
                              INTER_DOMAIN_LINK_PLUGID, LINK_COST,
                              LINK_DELAY, Lists.newArrayList(LINK_SRLG),
                              ODU4);
    links.put(networkLink.linkId(), networkLink);
    DeviceId ownerId = DeviceId.deviceId(DOMAIN_ID);
    TeTopologyId topologyId = new TeTopologyId(PROVIDER_ID, CLIENT_ID,
                                               Long.toString(ABSTRACT_TOPOLOGY_ID));
    network = networkBuilder(topologyId, null, nodes, links, false,
                             ownerId, OptimizationType.NOT_OPTIMIZED);
    return network;
}
 
Example 15
Source File: IsisTopologyProviderTest.java    From onos with Apache License 2.0 4 votes vote down vote up
@Test
public void isReachable() {
    DeviceId deviceId = DeviceId.deviceId("1010.1010.1111.00-22");
    provider.isReachable(deviceId);
}
 
Example 16
Source File: SoamManagerTest.java    From onos with Apache License 2.0 4 votes vote down vote up
@Test
public void testCreateDmNoBehavior() throws CfmConfigException, SoamConfigException {
    final DeviceId deviceId3 = DeviceId.deviceId("netconf:3.2.3.4:830");
    final MepId mepId3 = MepId.valueOf((short) 3);

    Map<Class<? extends Behaviour>, Class<? extends Behaviour>> behaviours = new HashMap<>();
    behaviours.put(DeviceDescriptionDiscovery.class, TestDeviceDiscoveryBehavior.class);

    Driver testDriver3 = new DefaultDriver(
            TEST_DRIVER_3, new ArrayList<Driver>(),
            TEST_MFR, TEST_HW_VERSION, TEST_SW_3,
            behaviours, new HashMap<>());

    Device device3 = new DefaultDevice(
            ProviderId.NONE, deviceId3, Device.Type.SWITCH,
            TEST_MFR, TEST_HW_VERSION, TEST_SW_3, TEST_SN,
            new ChassisId(2),
            DefaultAnnotations.builder().set(AnnotationKeys.DRIVER, TEST_DRIVER_3).build());

    expect(deviceService.getDevice(deviceId3)).andReturn(device3).anyTimes();
    replay(deviceService);

    MepEntry mep3 = DefaultMepEntry.builder(mepId3, deviceId3, PortNumber.P0,
            Mep.MepDirection.UP_MEP, MDNAME1, MANAME1)
            .buildEntry();

    expect(mepService.getMep(MDNAME1, MANAME1, mepId3)).andReturn(mep3).anyTimes();
    replay(mepService);

    expect(driverService.getDriver(deviceId3)).andReturn(testDriver3).anyTimes();
    replay(driverService);

    DelayMeasurementCreate dmCreate1 = DefaultDelayMeasurementCreate
            .builder(DelayMeasurementCreate.DmType.DM1DMTX,
                    DelayMeasurementCreate.Version.Y17312011,
                    MepId.valueOf((short) 11), Mep.Priority.PRIO3)
            .binsPerFdInterval((short) 4)
            .binsPerFdrInterval((short) 5)
            .binsPerIfdvInterval((short) 6)
            .build();

    try {
        soamManager.createDm(MDNAME1, MANAME1, mepId3, dmCreate1);
        fail("Expecting exception since device does not support behavior");
    } catch (CfmConfigException e) {
        assertEquals("Device netconf:3.2.3.4:830 from MEP :md-1/" +
                "ma-1-1/3 does not implement SoamDmProgrammable", e.getMessage());
    }
}
 
Example 17
Source File: MappingTestMocks.java    From onos with Apache License 2.0 4 votes vote down vote up
@Override
public DeviceId deviceId() {
    return DeviceId.deviceId("lisp:" + id);
}
 
Example 18
Source File: DefaultOpenstackNode.java    From onos with Apache License 2.0 4 votes vote down vote up
@Override
public DeviceId ovsdb() {
    return DeviceId.deviceId(OVSDB + managementIp().toString());
}
 
Example 19
Source File: MepCodec.java    From onos with Apache License 2.0 4 votes vote down vote up
/**
 * Decodes the Mep entity from JSON.
 *
 * @param json    JSON to decode
 * @param context decoding context
 * @param mdName The MD name
 * @param maName The MA name
 * @return decoded Mep
 * @throws java.lang.UnsupportedOperationException if the codec does not
 *                                                 support decode operations
 */
 public Mep decode(ObjectNode json, CodecContext context, String
                    mdName, String maName) {
    if (json == null || !json.isObject()) {
        return null;
    }

    JsonNode mepNode = json.get("mep");

    int mepId = Integer.parseInt(
            nullIsIllegal(mepNode.get("mepId"), "mepId is required").asText());
    DeviceId deviceId = DeviceId.deviceId(
            nullIsIllegal(mepNode.get("deviceId"), "deviceId is required")
            .asText());
    PortNumber port = PortNumber
            .portNumber(Long.parseLong(
                    nullIsIllegal(mepNode.get("port"), "port is required")
                    .asText()));
    MepDirection direction = MepDirection.valueOf(
            nullIsIllegal(mepNode.get("direction"), "direction is required").
            asText());

    try {
        MdId mdId = MdIdCharStr.asMdId(mdName);
        MaIdShort maId = MaIdCharStr.asMaId(maName);
        MepBuilder mepBuilder = DefaultMep
                .builder(MepId.valueOf((short) mepId),
                        deviceId, port, direction, mdId, maId);

        if (mepNode.get(PRIMARY_VID) != null) {
            mepBuilder.primaryVid(VlanId.vlanId(
                    (short) mepNode.get(PRIMARY_VID).asInt(0)));
        }

        if (mepNode.get(ADMINISTRATIVE_STATE) != null) {
            mepBuilder.administrativeState(mepNode.get(ADMINISTRATIVE_STATE)
                    .asBoolean());
        }

        if (mepNode.get(CCM_LTM_PRIORITY) != null) {
            mepBuilder.ccmLtmPriority(
                    Priority.values()[mepNode.get(CCM_LTM_PRIORITY).asInt(0)]);
        }

        if (mepNode.get(CCI_ENABLED) != null) {
            mepBuilder.cciEnabled(mepNode.get(CCI_ENABLED).asBoolean());
        }

        if (mepNode.get(LOWEST_FAULT_PRIORITY_DEFECT) != null) {
            mepBuilder.lowestFaultPriorityDefect(
                    Mep.LowestFaultDefect.values()[mepNode.get(LOWEST_FAULT_PRIORITY_DEFECT).asInt()]);
        }

        if (mepNode.get(DEFECT_ABSENT_TIME) != null) {
            mepBuilder.defectAbsentTime(
                    Duration.parse(mepNode.get(DEFECT_ABSENT_TIME).asText()));
        }

        if (mepNode.get(DEFECT_PRESENT_TIME) != null) {
            mepBuilder.defectPresentTime(
                    Duration.parse(mepNode.get(DEFECT_PRESENT_TIME).asText()));
        }

        if (mepNode.get(FNG_ADDRESS) != null) {
            mepBuilder.fngAddress((new FngAddressCodec())
                    .decode((ObjectNode) mepNode, context));
        }


        return mepBuilder.build();
    } catch (CfmConfigException e) {
        throw new IllegalArgumentException(e);
    }
}
 
Example 20
Source File: PcePathResourceTest.java    From onos with Apache License 2.0 4 votes vote down vote up
/**
 * Sets up the global values for all the tests.
 */
@Before
public void setUpTest() {
   // Mock environment setup
   MockPceCodecContext context = new MockPceCodecContext();
   ServiceDirectory testDirectory = new TestServiceDirectory().add(PceService.class, pceService)
                                                              .add(TunnelService.class, tunnelService)
                                                              .add(PceStore.class, pceStore)
                                                              .add(CodecService.class, context.codecManager());
   TestUtils.setField(BaseResource.class, "services", testDirectory);

   // Tunnel creation
   // Links
   ProviderId providerId = new ProviderId("of", "foo");
   deviceId1 = DeviceId.deviceId("of:A");
   deviceId2 = DeviceId.deviceId("of:B");
   deviceId3 = DeviceId.deviceId("of:C");
   deviceId4 = DeviceId.deviceId("of:D");
   deviceId5 = DeviceId.deviceId("of:E");
   port1 = PortNumber.portNumber(1);
   port2 = PortNumber.portNumber(2);
   port3 = PortNumber.portNumber(3);
   port4 = PortNumber.portNumber(4);
   port5 = PortNumber.portNumber(5);
   List<Link> linkList = new LinkedList<>();

   Link l1 = DefaultLink.builder()
                        .providerId(providerId)
                        .annotations(DefaultAnnotations.builder().set("key1", "yahoo").build())
                        .src(new ConnectPoint(deviceId1, port1))
                        .dst(new ConnectPoint(deviceId2, port2))
                        .type(DIRECT)
                        .state(Link.State.ACTIVE)
                        .build();
   linkList.add(l1);
   Link l2 = DefaultLink.builder()
                        .providerId(providerId)
                        .annotations(DefaultAnnotations.builder().set("key2", "yahoo").build())
                        .src(new ConnectPoint(deviceId2, port2))
                        .dst(new ConnectPoint(deviceId3, port3))
                        .type(DIRECT)
                        .state(Link.State.ACTIVE)
                        .build();
   linkList.add(l2);
   Link l3 = DefaultLink.builder()
                        .providerId(providerId)
                        .annotations(DefaultAnnotations.builder().set("key3", "yahoo").build())
                        .src(new ConnectPoint(deviceId3, port3))
                        .dst(new ConnectPoint(deviceId4, port4))
                        .type(DIRECT)
                        .state(Link.State.ACTIVE)
                        .build();
   linkList.add(l3);
   Link l4 = DefaultLink.builder()
                        .providerId(providerId)
                        .annotations(DefaultAnnotations.builder().set("key4", "yahoo").build())
                        .src(new ConnectPoint(deviceId4, port4))
                        .dst(new ConnectPoint(deviceId5, port5))
                        .type(DIRECT)
                        .state(Link.State.ACTIVE)
                        .build();
   linkList.add(l4);

   // Path
   path = new DefaultPath(providerId, linkList, ScalarWeight.toWeight(10));

   // Annotations
   DefaultAnnotations.Builder builderAnn = DefaultAnnotations.builder();
   builderAnn.set(PcepAnnotationKeys.LSP_SIG_TYPE, "WITH_SIGNALLING");
   builderAnn.set(PcepAnnotationKeys.COST_TYPE, "COST");
   builderAnn.set(PcepAnnotationKeys.BANDWIDTH, "200");

   // Tunnel
   tunnel = new DefaultTunnel(producerName, src, dst, Tunnel.Type.VXLAN,
                              Tunnel.State.ACTIVE, null, tunnelId,
                              tunnelName, path, builderAnn.build());

    explicitPathInfoList = Lists.newLinkedList();
    ExplicitPathInfo obj = new ExplicitPathInfo(ExplicitPathInfo.Type.LOOSE, deviceId2);
    explicitPathInfoList.add(obj);

}