Search in sources :

Example 1 with BgpInfoService

use of org.onosproject.routing.bgp.BgpInfoService in project onos by opennetworkinglab.

the class BgpNeighborsListCommand method doExecute.

@Override
protected void doExecute() {
    BgpInfoService service = AbstractShellCommand.get(BgpInfoService.class);
    Collection<BgpSession> bgpSessions = service.getBgpSessions();
    if (bgpNeighbor != null) {
        // Print a single neighbor (if found)
        BgpSession foundBgpSession = null;
        for (BgpSession bgpSession : bgpSessions) {
            if (bgpSession.remoteInfo().bgpId().toString().equals(bgpNeighbor)) {
                foundBgpSession = bgpSession;
                break;
            }
        }
        if (foundBgpSession != null) {
            printNeighbor(foundBgpSession);
        } else {
            print("BGP neighbor %s not found", bgpNeighbor);
        }
        return;
    }
    // Print all neighbors
    printNeighbors(bgpSessions);
}
Also used : BgpInfoService(org.onosproject.routing.bgp.BgpInfoService) BgpSession(org.onosproject.routing.bgp.BgpSession)

Example 2 with BgpInfoService

use of org.onosproject.routing.bgp.BgpInfoService in project onos by opennetworkinglab.

the class ArtemisDeaggregatorImpl method activate.

@Activate
protected void activate() {
    rulesInstalled = false;
    // FIXME: add other type of BGP Speakers when Dynamic Configuration is available
    bgpSpeakers.add(new QuaggaBgpSpeakers(bgpInfoService));
    moasServer = new MoasServerController();
    moasServer.start(moasAgent, packetProcessor);
    deviceService.addListener(deviceListener);
    appId = coreService.getAppId("org.onosproject.artemis");
    // enable OVSDB for the switches that we will install the GRE tunnel
    artemisService.getConfig().ifPresent(config -> config.moasInfo().getTunnelPoints().forEach(tunnelPoint -> ovsdbController.connect(tunnelPoint.getOvsdbIp(), TpPort.tpPort(6640))));
    artemisService.addListener(artemisEventListener);
    log.info("Artemis Deaggregator Service Started");
/*
        log.info("interfaces {}", interfaceService.getInterfaces());

        [{
         "name": "",
         "connectPoint": "of:000000000000000a/2",
         "ipAddresses": "[1.1.1.1/30]",
         "macAddress": "00:00:00:00:00:01"
        },
        {
         "name": "",
         "connectPoint": "of:000000000000000a/3",
         "ipAddresses": "[10.0.0.1/8]",
         "macAddress": "00:00:00:00:00:01"
        }]
        */
}
Also used : CoreService(org.onosproject.core.CoreService) ArtemisService(org.onosproject.artemis.ArtemisService) PortNumber(org.onosproject.net.PortNumber) DeviceService(org.onosproject.net.device.DeviceService) LoggerFactory(org.slf4j.LoggerFactory) ArtemisEventListener(org.onosproject.artemis.ArtemisEventListener) BgpInfoService(org.onosproject.routing.bgp.BgpInfoService) ForwardingObjective(org.onosproject.net.flowobjective.ForwardingObjective) DefaultTrafficTreatment(org.onosproject.net.flow.DefaultTrafficTreatment) Unpooled(io.netty.buffer.Unpooled) ArtemisMoasAgent(org.onosproject.artemis.ArtemisMoasAgent) JSONObject(org.json.JSONObject) FlowRuleService(org.onosproject.net.flow.FlowRuleService) OvsdbController(org.onosproject.ovsdb.controller.OvsdbController) Port(org.onosproject.net.Port) Map(java.util.Map) CharsetUtil(io.netty.util.CharsetUtil) ApplicationId(org.onosproject.core.ApplicationId) ArtemisPacketProcessor(org.onosproject.artemis.ArtemisPacketProcessor) TYPE_IPV4(org.onlab.packet.Ethernet.TYPE_IPV4) MoasClientController(org.onosproject.artemis.impl.moas.MoasClientController) Deactivate(org.osgi.service.component.annotations.Deactivate) BgpSpeakers(org.onosproject.artemis.BgpSpeakers) Set(java.util.Set) DefaultForwardingObjective(org.onosproject.net.flowobjective.DefaultForwardingObjective) Sets(com.google.common.collect.Sets) DeviceEvent(org.onosproject.net.device.DeviceEvent) Optional(java.util.Optional) DeviceId(org.onosproject.net.DeviceId) IpPrefix(org.onlab.packet.IpPrefix) QuaggaBgpSpeakers(org.onosproject.artemis.impl.bgpspeakers.QuaggaBgpSpeakers) MoasServerController(org.onosproject.artemis.impl.moas.MoasServerController) InterfaceService(org.onosproject.net.intf.InterfaceService) FlowObjectiveService(org.onosproject.net.flowobjective.FlowObjectiveService) ChannelHandlerContext(io.netty.channel.ChannelHandlerContext) Component(org.osgi.service.component.annotations.Component) TrafficSelector(org.onosproject.net.flow.TrafficSelector) ByteBuf(io.netty.buffer.ByteBuf) ArtemisDeaggregator(org.onosproject.artemis.ArtemisDeaggregator) OvsdbInterface(org.onosproject.ovsdb.controller.OvsdbInterface) Activate(org.osgi.service.component.annotations.Activate) DefaultTrafficSelector(org.onosproject.net.flow.DefaultTrafficSelector) IpAddress(org.onlab.packet.IpAddress) TpPort(org.onlab.packet.TpPort) TrafficTreatment(org.onosproject.net.flow.TrafficTreatment) DeviceListener(org.onosproject.net.device.DeviceListener) Logger(org.slf4j.Logger) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ArtemisMessage(org.onosproject.artemis.impl.objects.ArtemisMessage) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) Maps(com.google.common.collect.Maps) ReferenceCardinality(org.osgi.service.component.annotations.ReferenceCardinality) OvsdbBridge(org.onosproject.ovsdb.controller.OvsdbBridge) OvsdbClientService(org.onosproject.ovsdb.controller.OvsdbClientService) Reference(org.osgi.service.component.annotations.Reference) MoasServerController(org.onosproject.artemis.impl.moas.MoasServerController) QuaggaBgpSpeakers(org.onosproject.artemis.impl.bgpspeakers.QuaggaBgpSpeakers) Activate(org.osgi.service.component.annotations.Activate)

Example 3 with BgpInfoService

use of org.onosproject.routing.bgp.BgpInfoService in project onos by opennetworkinglab.

the class BgpRoutesListCommand method doExecute.

@Override
protected void doExecute() {
    BgpInfoService service = AbstractShellCommand.get(BgpInfoService.class);
    // Print summary of the routes
    if (routesSummary) {
        printSummary(service.getBgpRoutes4(), service.getBgpRoutes6());
        return;
    }
    BgpSession foundBgpSession = null;
    if (bgpNeighbor != null) {
        // Print the routes from a single neighbor (if found)
        for (BgpSession bgpSession : service.getBgpSessions()) {
            if (bgpSession.remoteInfo().bgpId().toString().equals(bgpNeighbor)) {
                foundBgpSession = bgpSession;
                break;
            }
        }
        if (foundBgpSession == null) {
            print("BGP neighbor %s not found", bgpNeighbor);
            return;
        }
    }
    // Print the routes
    if (foundBgpSession != null) {
        printRoutes(foundBgpSession.getBgpRibIn4(), foundBgpSession.getBgpRibIn6());
    } else {
        printRoutes(service.getBgpRoutes4(), service.getBgpRoutes6());
    }
}
Also used : BgpInfoService(org.onosproject.routing.bgp.BgpInfoService) BgpSession(org.onosproject.routing.bgp.BgpSession)

Aggregations

BgpInfoService (org.onosproject.routing.bgp.BgpInfoService)3 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Maps (com.google.common.collect.Maps)1 Sets (com.google.common.collect.Sets)1 ByteBuf (io.netty.buffer.ByteBuf)1 Unpooled (io.netty.buffer.Unpooled)1 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)1 CharsetUtil (io.netty.util.CharsetUtil)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Set (java.util.Set)1 JSONObject (org.json.JSONObject)1 TYPE_IPV4 (org.onlab.packet.Ethernet.TYPE_IPV4)1 IpAddress (org.onlab.packet.IpAddress)1 IpPrefix (org.onlab.packet.IpPrefix)1 TpPort (org.onlab.packet.TpPort)1 ArtemisDeaggregator (org.onosproject.artemis.ArtemisDeaggregator)1 ArtemisEventListener (org.onosproject.artemis.ArtemisEventListener)1 ArtemisMoasAgent (org.onosproject.artemis.ArtemisMoasAgent)1