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


Java OspfRouter类代码示例

本文整理汇总了Java中org.onosproject.ospf.controller.OspfRouter的典型用法代码示例。如果您正苦于以下问题:Java OspfRouter类的具体用法?Java OspfRouter怎么用?Java OspfRouter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: buildLinkDes

import org.onosproject.ospf.controller.OspfRouter; //导入依赖的package包/类
/**
 * Builds link description.
 *
 * @param ospfRouter  OSPF router instance
 * @param ospfLinkTed OSPF link TED instance
 * @return link description instance
 */
private LinkDescription buildLinkDes(OspfRouter ospfRouter, OspfLinkTed ospfLinkTed) {
    long srcAddress = 0;
    long dstAddress = 0;
    boolean localPseduo = false;
    //Changing of port numbers
    srcAddress = Ip4Address.valueOf(ospfRouter.routerIp().toString()).toInt();
    dstAddress = Ip4Address.valueOf(ospfRouter.neighborRouterId().toString()).toInt();
    DeviceId srcId = DeviceId.deviceId(OspfRouterId.uri(ospfRouter.routerIp()));
    DeviceId dstId = DeviceId.deviceId(OspfRouterId.uri(ospfRouter.neighborRouterId()));
    if (ospfRouter.isDr()) {
        localPseduo = true;
    }
    if (localPseduo && srcAddress == 0) {
        srcAddress = PSEUDO_PORT;
    }

    ConnectPoint src = new ConnectPoint(srcId, PortNumber.portNumber(srcAddress));
    ConnectPoint dst = new ConnectPoint(dstId, PortNumber.portNumber(dstAddress));

    return new DefaultLinkDescription(src, dst, Link.Type.DIRECT, false);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:29,代码来源:OspfTopologyProvider.java

示例2: routerAdded

import org.onosproject.ospf.controller.OspfRouter; //导入依赖的package包/类
@Override
public void routerAdded(OspfRouter ospfRouter) {
    String routerId = ospfRouter.routerIp().toString();
    log.info("Added device {}", routerId);
    DeviceId deviceId = DeviceId.deviceId(OspfRouterId.uri(ospfRouter.routerIp()));
    Device.Type deviceType = Device.Type.ROUTER;
    //If our routerType is Dr or Bdr type is PSEUDO
    if (ospfRouter.isDr()) {
        deviceType = Device.Type.ROUTER;
    } else {
        deviceType = Device.Type.VIRTUAL;
    }
    //deviceId = DeviceId.deviceId(routerDetails);
    ChassisId cId = new ChassisId();
    DefaultAnnotations.Builder newBuilder = DefaultAnnotations.builder();

    newBuilder.set(AnnotationKeys.TYPE, "l3");
    newBuilder.set("routerId", routerId);
    DeviceDescription description =
            new DefaultDeviceDescription(OspfRouterId.uri(ospfRouter.routerIp()),
                    deviceType, UNKNOWN, UNKNOWN, UNKNOWN,
                    UNKNOWN, cId, newBuilder.build());
    deviceProviderService.deviceConnected(deviceId, description);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:OspfTopologyProvider.java

示例3: addLink

import org.onosproject.ospf.controller.OspfRouter; //导入依赖的package包/类
@Override
public void addLink(OspfRouter ospfRouter, OspfLinkTed ospfLinkTed) {
    log.debug("Addlink {}", ospfRouter.routerIp());
    LinkDescription linkDes = buildLinkDes(ospfRouter, ospfLinkTed);
    //If already link exists, return
    if (linkService.getLink(linkDes.src(), linkDes.dst()) != null || linkProviderService == null) {
        return;
    }
    //Updating ports of the link
    List<PortDescription> srcPortDescriptions = new LinkedList<>();
    srcPortDescriptions.add(new DefaultPortDescription(linkDes.src().port(), true));
    deviceProviderService.updatePorts(linkDes.src().deviceId(), srcPortDescriptions);

    List<PortDescription> dstPortDescriptions = new LinkedList<>();
    dstPortDescriptions.add(new DefaultPortDescription(linkDes.dst().port(), true));
    deviceProviderService.updatePorts(linkDes.dst().deviceId(), dstPortDescriptions);
    linkProviderService.linkDetected(linkDes);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:19,代码来源:OspfTopologyProvider.java

示例4: deleteLink

import org.onosproject.ospf.controller.OspfRouter; //导入依赖的package包/类
@Override
public void deleteLink(OspfRouter ospfRouter, OspfLinkTed ospfLinkTed) {
    log.debug("Delete link {}", ospfRouter.routerIp().toString());
    if (linkProviderService == null) {
        return;
    }
    LinkDescription linkDes = buildLinkDes(ospfRouter, ospfLinkTed);
    //Updating ports of the link
    List<PortDescription> srcPortDescriptions = new LinkedList<>();
    srcPortDescriptions.add(new DefaultPortDescription(linkDes.src().port(), true));
    deviceProviderService.updatePorts(linkDes.src().deviceId(), srcPortDescriptions);

    List<PortDescription> dstPortDescriptions = new LinkedList<>();
    dstPortDescriptions.add(new DefaultPortDescription(linkDes.dst().port(), true));
    deviceProviderService.updatePorts(linkDes.dst().deviceId(), dstPortDescriptions);
    linkProviderService.linkVanished(linkDes);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:OspfTopologyProvider.java

示例5: addConnectedRouter

import org.onosproject.ospf.controller.OspfRouter; //导入依赖的package包/类
@Override
public boolean addConnectedRouter(OspfRouter ospfRouter) {
    for (OspfRouterListener l : listener()) {
        l.routerAdded(ospfRouter);
    }
    return true;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:8,代码来源:OspfControllerImpl.java

示例6: addLink

import org.onosproject.ospf.controller.OspfRouter; //导入依赖的package包/类
@Override
public void addLink(OspfRouter ospfRouter, OspfLinkTed ospfLinkTed) {
    for (OspfLinkListener l : linkListener()) {
        l.addLink(ospfRouter, ospfLinkTed);
    }

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

示例7: neighborDown

import org.onosproject.ospf.controller.OspfRouter; //导入依赖的package包/类
/**
 * Called when neighbor is down.
 *
 * @throws Exception might throws exception
 */
public void neighborDown() throws Exception {
    log.debug("Neighbor Down {} and NeighborId {}", neighborIpAddr,
              neighborId);
    stopInactivityTimeCheck();
    stopRxMtDdTimer();
    stopRxMtLsrTimer();

    if (floodingTimerScheduled) {
        stopFloodingTimer();
        floodingTimerScheduled = false;
    }

    state = OspfNeighborState.DOWN;
    ospfArea.refreshArea(ospfInterface);
    lsReqList.clear();
    ddSummaryList.clear();
    if (neighborIpAddr.equals(neighborBdr) ||
            neighborIpAddr.equals(neighborDr)) {
        ((OspfInterfaceImpl) ospfInterface).neighborChange();
    }
    log.debug("Neighbor Went Down : "
                      + this.neighborIpAddr + " , " + this.neighborId);
    removeDeviceDetails(this.neighborId);
    OspfRouter ospfRouter = new OspfRouterImpl();
    ospfRouter.setRouterIp(this.neighborId());
    ospfRouter.setInterfaceId(ospfInterface.ipAddress());
    ospfRouter.setAreaIdOfInterface(ospfArea.areaId());
    ospfRouter.setDeviceTed(new OspfDeviceTedImpl());
    ((OspfInterfaceImpl) ospfInterface).removeDeviceInformation(ospfRouter);
    removeDeviceDetails(this.neighborIpAddr);
    OspfRouter ospfRouter1 = new OspfRouterImpl();
    ospfRouter1.setRouterIp(this.neighborIpAddr);
    ospfRouter1.setInterfaceId(ospfInterface.ipAddress());
    ospfRouter1.setAreaIdOfInterface(ospfArea.areaId());
    ospfRouter1.setDeviceTed(new OspfDeviceTedImpl());
    ((OspfInterfaceImpl) ospfInterface).removeDeviceInformation(ospfRouter1);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:43,代码来源:OspfNbrImpl.java

示例8: routerRemoved

import org.onosproject.ospf.controller.OspfRouter; //导入依赖的package包/类
@Override
public void routerRemoved(OspfRouter ospfRouter) {
    String routerId = ospfRouter.routerIp().toString();
    log.info("Delete device {}", routerId);
    DeviceId deviceId = DeviceId.deviceId(OspfRouterId.uri(ospfRouter.routerIp()));
    if (deviceProviderService == null) {
        return;
    }
    deviceProviderService.deviceDisconnected(deviceId);
    log.info("delete device {}", routerId);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:12,代码来源:OspfTopologyProvider.java

示例9: ospfTopologyProviderTestAddDevice2

import org.onosproject.ospf.controller.OspfRouter; //导入依赖的package包/类
@Test
public void ospfTopologyProviderTestAddDevice2() {
    int deviceAddCount = 0;
    OspfRouter ospfRouter = new OspfRouterImpl();
    ospfRouter.setDr(true);
    ospfRouter.setOpaque(true);
    ospfRouter.setNeighborRouterId(Ip4Address.valueOf("3.3.3.3"));
    ospfRouter.setInterfaceId(Ip4Address.valueOf("10.10.10.3"));
    ospfRouter.setAreaIdOfInterface(Ip4Address.valueOf("6.6.6.6"));
    ospfRouter.setRouterIp(Ip4Address.valueOf("7.7.7.7"));
    OspfDeviceTed ospfDeviceTed = new OspfDeviceTedImpl();
    ospfDeviceTed.setAbr(true);
    ospfDeviceTed.setAsbr(true);
    ospfRouter.setDeviceTed(ospfDeviceTed);
    OspfLinkTed ospfLinkTed = new OspfLinkTedImpl();
    ospfLinkTed.setMaximumLink(Bandwidth.bps(30));
    ospfLinkTed.setMaxReserved(Bandwidth.bps(40));
    ospfLinkTed.setTeMetric(50);
    for (OspfRouterListener l : controller.nodeListener) {
        l.routerAdded(ospfRouter);
        deviceAddCount = nodeRegistry.connected.size();
        assertTrue(deviceAddCount == 1);
        l.routerRemoved(ospfRouter);
        deviceAddCount = nodeRegistry.connected.size();
        assertTrue(deviceAddCount == 0);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:28,代码来源:OspfTopologyProviderTest.java

示例10: neighborDown

import org.onosproject.ospf.controller.OspfRouter; //导入依赖的package包/类
/**
 * Called when neighbor is down.
 */
public void neighborDown() {
    log.debug("Neighbor Down {} and NeighborId {}", neighborIpAddr,
              neighborId);
    stopInactivityTimeCheck();
    stopRxMtDdTimer();
    stopRxMtLsrTimer();

    if (floodingTimerScheduled) {
        stopFloodingTimer();
        floodingTimerScheduled = false;
    }

    state = OspfNeighborState.DOWN;
    ospfArea.refreshArea(ospfInterface);
    lsReqList.clear();
    ddSummaryList.clear();
    if (neighborIpAddr.equals(neighborBdr) ||
            neighborIpAddr.equals(neighborDr)) {
        ((OspfInterfaceImpl) ospfInterface).neighborChange();
    }
    log.debug("Neighbor Went Down : "
                      + this.neighborIpAddr + " , " + this.neighborId);
    removeDeviceDetails(this.neighborId);
    OspfRouter ospfRouter = new OspfRouterImpl();
    ospfRouter.setRouterIp(this.neighborId());
    ospfRouter.setInterfaceId(ospfInterface.ipAddress());
    ospfRouter.setAreaIdOfInterface(ospfArea.areaId());
    ospfRouter.setDeviceTed(new OspfDeviceTedImpl());
    ((OspfInterfaceImpl) ospfInterface).removeDeviceInformation(ospfRouter);
    removeDeviceDetails(this.neighborIpAddr);
    OspfRouter ospfRouter1 = new OspfRouterImpl();
    ospfRouter1.setRouterIp(this.neighborIpAddr);
    ospfRouter1.setInterfaceId(ospfInterface.ipAddress());
    ospfRouter1.setAreaIdOfInterface(ospfArea.areaId());
    ospfRouter1.setDeviceTed(new OspfDeviceTedImpl());
    ((OspfInterfaceImpl) ospfInterface).removeDeviceInformation(ospfRouter1);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:41,代码来源:OspfNbrImpl.java

示例11: removeConnectedRouter

import org.onosproject.ospf.controller.OspfRouter; //导入依赖的package包/类
@Override
public void removeConnectedRouter(OspfRouter ospfRouter) {
    for (OspfRouterListener l : listener()) {
        l.routerRemoved(ospfRouter);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:7,代码来源:OspfControllerImpl.java

示例12: deleteLink

import org.onosproject.ospf.controller.OspfRouter; //导入依赖的package包/类
@Override
public void deleteLink(OspfRouter ospfRouter, OspfLinkTed ospfLinkTed) {
    for (OspfLinkListener l : linkListener()) {
        l.deleteLink(ospfRouter, ospfLinkTed);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:7,代码来源:OspfControllerImpl.java

示例13: routerChanged

import org.onosproject.ospf.controller.OspfRouter; //导入依赖的package包/类
@Override
public void routerChanged(OspfRouter ospfRouter) {
    log.info("Router changed is not supported currently");
}
 
开发者ID:shlee89,项目名称:athena,代码行数:5,代码来源:OspfTopologyProvider.java

示例14: addDeviceInformation

import org.onosproject.ospf.controller.OspfRouter; //导入依赖的package包/类
/**
 * Adds device information.
 *
 * @param ospfRouter OSPF router instance
 */
public void addDeviceInformation(OspfRouter ospfRouter) {
    controller.addDeviceDetails(ospfRouter);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:9,代码来源:OspfInterfaceImpl.java

示例15: removeDeviceInformation

import org.onosproject.ospf.controller.OspfRouter; //导入依赖的package包/类
/**
 * removes device information.
 *
 * @param ospfRouter OSPF neighbor instance
 */
public void removeDeviceInformation(OspfRouter ospfRouter) {
    controller.removeDeviceDetails(ospfRouter);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:9,代码来源:OspfInterfaceImpl.java


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