Search in sources :

Example 1 with GatewayNode

use of org.onosproject.scalablegateway.api.GatewayNode in project onos by opennetworkinglab.

the class ScalableGatewayDeleteCommand method doExecute.

@Override
protected void doExecute() {
    ScalableGatewayService service = get(ScalableGatewayService.class);
    GatewayNode gatewayNode = service.getGatewayNode(DeviceId.deviceId(deviceId));
    if (gatewayNode == null) {
        print(UNKNOWN);
        return;
    }
    if (service.deleteGatewayNode(gatewayNode)) {
        print(SUCCESS);
    } else {
        print(FAIL);
    }
}
Also used : GatewayNode(org.onosproject.scalablegateway.api.GatewayNode) ScalableGatewayService(org.onosproject.scalablegateway.api.ScalableGatewayService)

Example 2 with GatewayNode

use of org.onosproject.scalablegateway.api.GatewayNode in project onos by opennetworkinglab.

the class ScalableGatewayAddCommand method doExecute.

@Override
protected void doExecute() {
    ScalableGatewayService service = get(ScalableGatewayService.class);
    GatewayNode gatewayNode = GatewayNode.builder().gatewayDeviceId(DeviceId.deviceId(deviceId)).dataIpAddress(Ip4Address.valueOf(ipAddress)).uplinkIntf(interfaceName).build();
    if (service.addGatewayNode(gatewayNode)) {
        print(SUCCESS);
    } else {
        print(FAIL);
    }
}
Also used : GatewayNode(org.onosproject.scalablegateway.api.GatewayNode) ScalableGatewayService(org.onosproject.scalablegateway.api.ScalableGatewayService)

Example 3 with GatewayNode

use of org.onosproject.scalablegateway.api.GatewayNode in project onos by opennetworkinglab.

the class ScalableGatewayManager method getUplinkPort.

@Override
public PortNumber getUplinkPort(DeviceId deviceId) {
    GatewayNode gatewayNode = gatewayNodeMap.get(deviceId).value();
    if (gatewayNode == null) {
        log.warn("Gateway with device ID {} does not exist");
        return null;
    }
    Optional<Port> port = deviceService.getPorts(deviceId).stream().filter(p -> Objects.equals(p.annotations().value(PORT_NAME), gatewayNode.getUplinkIntf())).findFirst();
    if (!port.isPresent()) {
        log.warn("Cannot find uplink interface from gateway {}", deviceId);
        return null;
    }
    return port.get().number();
}
Also used : ConsistentMap(org.onosproject.store.service.ConsistentMap) NetworkConfigService(org.onosproject.net.config.NetworkConfigService) NetworkConfigRegistry(org.onosproject.net.config.NetworkConfigRegistry) ScalableGatewayService(org.onosproject.scalablegateway.api.ScalableGatewayService) Tools(org.onlab.util.Tools) CoreService(org.onosproject.core.CoreService) PortNumber(org.onosproject.net.PortNumber) NetworkConfigEvent(org.onosproject.net.config.NetworkConfigEvent) DeviceService(org.onosproject.net.device.DeviceService) LoggerFactory(org.slf4j.LoggerFactory) PORT_NAME(org.onosproject.net.AnnotationKeys.PORT_NAME) KryoNamespace(org.onlab.util.KryoNamespace) GroupKey(org.onosproject.net.group.GroupKey) DriverService(org.onosproject.net.driver.DriverService) Group(org.onosproject.net.group.Group) Component(org.osgi.service.component.annotations.Component) Lists(com.google.common.collect.Lists) StorageService(org.onosproject.store.service.StorageService) ImmutableList(com.google.common.collect.ImmutableList) SubjectFactories(org.onosproject.net.config.basics.SubjectFactories) Port(org.onosproject.net.Port) ApplicationId(org.onosproject.core.ApplicationId) Activate(org.osgi.service.component.annotations.Activate) GatewayNodeConfig(org.onosproject.scalablegateway.api.GatewayNodeConfig) KryoNamespaces(org.onosproject.store.serializers.KryoNamespaces) Serializer(org.onosproject.store.service.Serializer) DeviceListener(org.onosproject.net.device.DeviceListener) Logger(org.slf4j.Logger) Deactivate(org.osgi.service.component.annotations.Deactivate) GroupService(org.onosproject.net.group.GroupService) GatewayNode(org.onosproject.scalablegateway.api.GatewayNode) ReferenceCardinality(org.osgi.service.component.annotations.ReferenceCardinality) Objects(java.util.Objects) Versioned(org.onosproject.store.service.Versioned) ConfigFactory(org.onosproject.net.config.ConfigFactory) List(java.util.List) GroupId(org.onosproject.core.GroupId) DeviceEvent(org.onosproject.net.device.DeviceEvent) Optional(java.util.Optional) DeviceId(org.onosproject.net.DeviceId) Reference(org.osgi.service.component.annotations.Reference) NetworkConfigListener(org.onosproject.net.config.NetworkConfigListener) GatewayNode(org.onosproject.scalablegateway.api.GatewayNode) Port(org.onosproject.net.Port)

Aggregations

GatewayNode (org.onosproject.scalablegateway.api.GatewayNode)3 ScalableGatewayService (org.onosproject.scalablegateway.api.ScalableGatewayService)3 ImmutableList (com.google.common.collect.ImmutableList)1 Lists (com.google.common.collect.Lists)1 List (java.util.List)1 Objects (java.util.Objects)1 Optional (java.util.Optional)1 KryoNamespace (org.onlab.util.KryoNamespace)1 Tools (org.onlab.util.Tools)1 ApplicationId (org.onosproject.core.ApplicationId)1 CoreService (org.onosproject.core.CoreService)1 GroupId (org.onosproject.core.GroupId)1 PORT_NAME (org.onosproject.net.AnnotationKeys.PORT_NAME)1 DeviceId (org.onosproject.net.DeviceId)1 Port (org.onosproject.net.Port)1 PortNumber (org.onosproject.net.PortNumber)1 ConfigFactory (org.onosproject.net.config.ConfigFactory)1 NetworkConfigEvent (org.onosproject.net.config.NetworkConfigEvent)1 NetworkConfigListener (org.onosproject.net.config.NetworkConfigListener)1 NetworkConfigRegistry (org.onosproject.net.config.NetworkConfigRegistry)1