Search in sources :

Example 1 with K8sBridge

use of org.onosproject.k8snode.api.K8sBridge in project onos by opennetworkinglab.

the class DefaultK8sHostHandler method createBridge.

private void createBridge(DeviceId ovsdb, K8sBridge bridge) {
    Device device = deviceService.getDevice(ovsdb);
    List<ControllerInfo> controllers = clusterService.getNodes().stream().map(n -> new ControllerInfo(n.ip(), DEFAULT_OFPORT, DEFAULT_OF_PROTO)).collect(Collectors.toList());
    String dpid = bridge.dpid().substring(DPID_BEGIN);
    BridgeDescription.Builder builder = DefaultBridgeDescription.builder().name(bridge.name()).failMode(BridgeDescription.FailMode.SECURE).datapathId(dpid).disableInBand().controllers(controllers);
    BridgeConfig bridgeConfig = device.as(BridgeConfig.class);
    bridgeConfig.addBridge(builder.build());
}
Also used : DefaultBridgeDescription(org.onosproject.net.behaviour.DefaultBridgeDescription) CoreService(org.onosproject.core.CoreService) K8sNodeAdminService(org.onosproject.k8snode.api.K8sNodeAdminService) DeviceService(org.onosproject.net.device.DeviceService) Tools.groupedThreads(org.onlab.util.Tools.groupedThreads) K8sHostState(org.onosproject.k8snode.api.K8sHostState) VXLAN(org.onosproject.k8snode.api.Constants.VXLAN) TpPort.tpPort(org.onlab.packet.TpPort.tpPort) OvsdbController(org.onosproject.ovsdb.controller.OvsdbController) K8sHostListener(org.onosproject.k8snode.api.K8sHostListener) Port(org.onosproject.net.Port) ApplicationId(org.onosproject.core.ApplicationId) Thread.sleep(java.lang.Thread.sleep) NodeId(org.onosproject.cluster.NodeId) Device(org.onosproject.net.Device) Deactivate(org.osgi.service.component.annotations.Deactivate) Executors.newSingleThreadExecutor(java.util.concurrent.Executors.newSingleThreadExecutor) Collectors(java.util.stream.Collectors) DefaultPatchDescription(org.onosproject.net.behaviour.DefaultPatchDescription) Objects(java.util.Objects) DEVICE_CREATED(org.onosproject.k8snode.api.K8sHostState.DEVICE_CREATED) List(java.util.List) COMPLETE(org.onosproject.k8snode.api.K8sHostState.COMPLETE) TunnelEndPoints(org.onosproject.net.behaviour.TunnelEndPoints) K8sTunnelBridge(org.onosproject.k8snode.api.K8sTunnelBridge) K8sHostEvent(org.onosproject.k8snode.api.K8sHostEvent) DeviceEvent(org.onosproject.net.device.DeviceEvent) ClusterService(org.onosproject.cluster.ClusterService) DeviceId(org.onosproject.net.DeviceId) BridgeConfig(org.onosproject.net.behaviour.BridgeConfig) InterfaceConfig(org.onosproject.net.behaviour.InterfaceConfig) GENEVE(org.onosproject.k8snode.api.Constants.GENEVE) GRE(org.onosproject.k8snode.api.Constants.GRE) OvsdbNodeId(org.onosproject.ovsdb.controller.OvsdbNodeId) BridgeDescription(org.onosproject.net.behaviour.BridgeDescription) PORT_NAME(org.onosproject.net.AnnotationKeys.PORT_NAME) TunnelKey(org.onosproject.net.behaviour.TunnelKey) INIT(org.onosproject.k8snode.api.K8sHostState.INIT) K8sRouterBridge(org.onosproject.k8snode.api.K8sRouterBridge) Component(org.osgi.service.component.annotations.Component) DefaultTunnelDescription(org.onosproject.net.behaviour.DefaultTunnelDescription) Activate(org.osgi.service.component.annotations.Activate) K8sNode(org.onosproject.k8snode.api.K8sNode) ExecutorService(java.util.concurrent.ExecutorService) ControllerInfo(org.onosproject.net.behaviour.ControllerInfo) DeviceListener(org.onosproject.net.device.DeviceListener) OS_INTEGRATION_BRIDGE(org.onosproject.k8snode.api.Constants.OS_INTEGRATION_BRIDGE) Logger(org.slf4j.Logger) PatchDescription(org.onosproject.net.behaviour.PatchDescription) APP_ID(org.onosproject.k8snode.api.K8sNodeService.APP_ID) TunnelDescription(org.onosproject.net.behaviour.TunnelDescription) K8sHostHandler(org.onosproject.k8snode.api.K8sHostHandler) K8sBridge(org.onosproject.k8snode.api.K8sBridge) K8sHostAdminService(org.onosproject.k8snode.api.K8sHostAdminService) ReferenceCardinality(org.osgi.service.component.annotations.ReferenceCardinality) DeviceAdminService(org.onosproject.net.device.DeviceAdminService) INCOMPLETE(org.onosproject.k8snode.api.K8sHostState.INCOMPLETE) LoggerFactory.getLogger(org.slf4j.LoggerFactory.getLogger) OvsdbClientService(org.onosproject.ovsdb.controller.OvsdbClientService) K8sHost(org.onosproject.k8snode.api.K8sHost) Reference(org.osgi.service.component.annotations.Reference) LeadershipService(org.onosproject.cluster.LeadershipService) Device(org.onosproject.net.Device) BridgeConfig(org.onosproject.net.behaviour.BridgeConfig) DefaultBridgeDescription(org.onosproject.net.behaviour.DefaultBridgeDescription) BridgeDescription(org.onosproject.net.behaviour.BridgeDescription) ControllerInfo(org.onosproject.net.behaviour.ControllerInfo)

Aggregations

Thread.sleep (java.lang.Thread.sleep)1 List (java.util.List)1 Objects (java.util.Objects)1 ExecutorService (java.util.concurrent.ExecutorService)1 Executors.newSingleThreadExecutor (java.util.concurrent.Executors.newSingleThreadExecutor)1 Collectors (java.util.stream.Collectors)1 TpPort.tpPort (org.onlab.packet.TpPort.tpPort)1 Tools.groupedThreads (org.onlab.util.Tools.groupedThreads)1 ClusterService (org.onosproject.cluster.ClusterService)1 LeadershipService (org.onosproject.cluster.LeadershipService)1 NodeId (org.onosproject.cluster.NodeId)1 ApplicationId (org.onosproject.core.ApplicationId)1 CoreService (org.onosproject.core.CoreService)1 GENEVE (org.onosproject.k8snode.api.Constants.GENEVE)1 GRE (org.onosproject.k8snode.api.Constants.GRE)1 OS_INTEGRATION_BRIDGE (org.onosproject.k8snode.api.Constants.OS_INTEGRATION_BRIDGE)1 VXLAN (org.onosproject.k8snode.api.Constants.VXLAN)1 K8sBridge (org.onosproject.k8snode.api.K8sBridge)1 K8sHost (org.onosproject.k8snode.api.K8sHost)1 K8sHostAdminService (org.onosproject.k8snode.api.K8sHostAdminService)1