Search in sources :

Example 16 with InterfaceConfig

use of org.onosproject.net.behaviour.InterfaceConfig in project onos by opennetworkinglab.

the class DefaultK8sNodeHandler method createPatchInterfaces.

private void createPatchInterfaces(K8sNode k8sNode) {
    Device device = deviceService.getDevice(k8sNode.ovsdb());
    if (device == null || !device.is(InterfaceConfig.class)) {
        log.error("Failed to create patch interface on {}", k8sNode.ovsdb());
        return;
    }
    // integration bridge -> external bridge
    PatchDescription brIntExtPatchDesc = DefaultPatchDescription.builder().deviceId(k8sNode.intgBridgeName()).ifaceName(k8sNode.intgToExtPatchPortName()).peer(k8sNode.extToIntgPatchPortName()).build();
    // integration bridge -> tunnel bridge
    PatchDescription brIntTunPatchDesc = DefaultPatchDescription.builder().deviceId(k8sNode.intgBridgeName()).ifaceName(k8sNode.intgToTunPatchPortName()).peer(k8sNode.tunToIntgPatchPortName()).build();
    // external bridge -> integration bridge
    PatchDescription brExtIntPatchDesc = DefaultPatchDescription.builder().deviceId(k8sNode.extBridgeName()).ifaceName(k8sNode.extToIntgPatchPortName()).peer(k8sNode.intgToExtPatchPortName()).build();
    // integration bridge -> local bridge
    PatchDescription brIntLocalPatchDesc = DefaultPatchDescription.builder().deviceId(k8sNode.intgBridgeName()).ifaceName(k8sNode.intgToLocalPatchPortName()).peer(k8sNode.localToIntgPatchPortName()).build();
    // local bridge -> integration bridge
    PatchDescription brLocalIntPatchDesc = DefaultPatchDescription.builder().deviceId(k8sNode.localBridgeName()).ifaceName(k8sNode.localToIntgPatchPortName()).peer(k8sNode.intgToLocalPatchPortName()).build();
    InterfaceConfig ifaceConfig = device.as(InterfaceConfig.class);
    ifaceConfig.addPatchMode(k8sNode.intgToExtPatchPortName(), brIntExtPatchDesc);
    ifaceConfig.addPatchMode(k8sNode.extToIntgPatchPortName(), brExtIntPatchDesc);
    ifaceConfig.addPatchMode(k8sNode.intgToLocalPatchPortName(), brIntLocalPatchDesc);
    ifaceConfig.addPatchMode(k8sNode.localToIntgPatchPortName(), brLocalIntPatchDesc);
    ifaceConfig.addPatchMode(k8sNode.intgToTunPatchPortName(), brIntTunPatchDesc);
    if (k8sNode.mode() == NORMAL) {
        // tunnel bridge -> integration bridge
        PatchDescription brTunIntPatchDesc = DefaultPatchDescription.builder().deviceId(k8sNode.tunBridgeName()).ifaceName(k8sNode.tunToIntgPatchPortName()).peer(k8sNode.intgToTunPatchPortName()).build();
        ifaceConfig.addPatchMode(k8sNode.tunToIntgPatchPortName(), brTunIntPatchDesc);
    } else {
        // k8s integration bridge -> openstack integration bridge
        PatchDescription k8sIntOsIntPatchDesc = DefaultPatchDescription.builder().deviceId(k8sNode.intgBridgeName()).ifaceName(k8sNode.k8sIntgToOsPatchPortName()).peer(k8sNode.osToK8sIntgPatchPortName()).build();
        ifaceConfig.addPatchMode(k8sNode.k8sIntgToOsPatchPortName(), k8sIntOsIntPatchDesc);
        // k8s external bridge -> openstack integration bridge
        PatchDescription k8sExtOsIntPatchDesc = DefaultPatchDescription.builder().deviceId(k8sNode.extBridgeName()).ifaceName(k8sNode.k8sExtToOsPatchPortName()).peer(k8sNode.osToK8sExtPatchPortName()).build();
        ifaceConfig.addPatchMode(k8sNode.k8sExtToOsPatchPortName(), k8sExtOsIntPatchDesc);
        // external bridge -> router bridge
        PatchDescription extRouterPatchDesc = DefaultPatchDescription.builder().deviceId(k8sNode.extBridgeName()).ifaceName(k8sNode.extToRouterPatchPortName()).peer(k8sNode.routerToExtPatchPortName()).build();
        ifaceConfig.addPatchMode(k8sNode.extToRouterPatchPortName(), extRouterPatchDesc);
    }
}
Also used : InterfaceConfig(org.onosproject.net.behaviour.InterfaceConfig) Device(org.onosproject.net.Device) DefaultPatchDescription(org.onosproject.net.behaviour.DefaultPatchDescription) PatchDescription(org.onosproject.net.behaviour.PatchDescription)

Example 17 with InterfaceConfig

use of org.onosproject.net.behaviour.InterfaceConfig in project onos by opennetworkinglab.

the class DefaultK8sHostHandler method createTunnelInterface.

private void createTunnelInterface(DeviceId ovsdb, K8sTunnelBridge bridge, String type, String intfName) {
    if (isTunPortEnabled(bridge, intfName)) {
        return;
    }
    Device device = deviceService.getDevice(ovsdb);
    if (device == null || !device.is(InterfaceConfig.class)) {
        log.error("Failed to create tunnel interface on {}", ovsdb);
        return;
    }
    TunnelDescription tunnelDesc = buildTunnelDesc(bridge, type, intfName);
    InterfaceConfig ifaceConfig = device.as(InterfaceConfig.class);
    ifaceConfig.addTunnelMode(intfName, tunnelDesc);
}
Also used : InterfaceConfig(org.onosproject.net.behaviour.InterfaceConfig) Device(org.onosproject.net.Device) DefaultTunnelDescription(org.onosproject.net.behaviour.DefaultTunnelDescription) TunnelDescription(org.onosproject.net.behaviour.TunnelDescription)

Example 18 with InterfaceConfig

use of org.onosproject.net.behaviour.InterfaceConfig in project onos by opennetworkinglab.

the class DefaultK8sHostHandler method createRouterPatchInterfaces.

private void createRouterPatchInterfaces(DeviceId ovsdb, K8sBridge bridge, K8sNode k8sNode) {
    Device device = deviceService.getDevice(ovsdb);
    if (device == null || !device.is(InterfaceConfig.class)) {
        log.error("Failed to create patch interface on {}", ovsdb);
        return;
    }
    InterfaceConfig ifaceConfig = device.as(InterfaceConfig.class);
    // router bridge -> external bridge
    PatchDescription brRouterExtPatchDesc = DefaultPatchDescription.builder().deviceId(bridge.name()).ifaceName(k8sNode.routerToExtPatchPortName()).peer(k8sNode.extToRouterPatchPortName()).build();
    ifaceConfig.addPatchMode(k8sNode.tunToIntgPatchPortName(), brRouterExtPatchDesc);
}
Also used : InterfaceConfig(org.onosproject.net.behaviour.InterfaceConfig) Device(org.onosproject.net.Device) DefaultPatchDescription(org.onosproject.net.behaviour.DefaultPatchDescription) PatchDescription(org.onosproject.net.behaviour.PatchDescription)

Example 19 with InterfaceConfig

use of org.onosproject.net.behaviour.InterfaceConfig in project onos by opennetworkinglab.

the class DefaultK8sHostHandler method createTunnelPatchInterfaces.

private void createTunnelPatchInterfaces(DeviceId ovsdb, K8sBridge bridge, K8sNode k8sNode) {
    Device device = deviceService.getDevice(ovsdb);
    if (device == null || !device.is(InterfaceConfig.class)) {
        log.error("Failed to create patch interface on {}", ovsdb);
        return;
    }
    InterfaceConfig ifaceConfig = device.as(InterfaceConfig.class);
    // tunnel bridge -> k8s integration bridge
    PatchDescription brTunIntPatchDesc = DefaultPatchDescription.builder().deviceId(bridge.name()).ifaceName(k8sNode.tunToIntgPatchPortName()).peer(k8sNode.intgToTunPatchPortName()).build();
    ifaceConfig.addPatchMode(k8sNode.tunToIntgPatchPortName(), brTunIntPatchDesc);
}
Also used : InterfaceConfig(org.onosproject.net.behaviour.InterfaceConfig) Device(org.onosproject.net.Device) DefaultPatchDescription(org.onosproject.net.behaviour.DefaultPatchDescription) PatchDescription(org.onosproject.net.behaviour.PatchDescription)

Aggregations

InterfaceConfig (org.onosproject.net.behaviour.InterfaceConfig)19 Device (org.onosproject.net.Device)16 DefaultPatchDescription (org.onosproject.net.behaviour.DefaultPatchDescription)8 PatchDescription (org.onosproject.net.behaviour.PatchDescription)8 DefaultTunnelDescription (org.onosproject.net.behaviour.DefaultTunnelDescription)5 TunnelDescription (org.onosproject.net.behaviour.TunnelDescription)5 DriverHandler (org.onosproject.net.driver.DriverHandler)3 DeviceId (org.onosproject.net.DeviceId)2 DriverService (org.onosproject.net.driver.DriverService)2 DeviceInterfaceDescription (org.onosproject.net.device.DeviceInterfaceDescription)1