Search in sources :

Example 1 with InterfaceConfig

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

the class DefaultK8sNodeHandler method createTunnelInterface.

/**
 * Creates a tunnel interface in a given kubernetes node.
 *
 * @param k8sNode       kubernetes node
 */
private void createTunnelInterface(K8sNode k8sNode, String type, String intfName) {
    if (isIntfEnabled(k8sNode, intfName)) {
        return;
    }
    Device device = deviceService.getDevice(k8sNode.ovsdb());
    if (device == null || !device.is(InterfaceConfig.class)) {
        log.error("Failed to create tunnel interface on {}", k8sNode.ovsdb());
        return;
    }
    TunnelDescription tunnelDesc = buildTunnelDesc(k8sNode, 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 2 with InterfaceConfig

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

the class DefaultK8sHostHandler method createInterPatchInterfaces.

private void createInterPatchInterfaces(DeviceId ovsdb, 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);
    // openstack integration bridge -> k8s integration bridge
    PatchDescription osIntK8sIntPatchDesc = DefaultPatchDescription.builder().deviceId(OS_INTEGRATION_BRIDGE).ifaceName(k8sNode.osToK8sIntgPatchPortName()).peer(k8sNode.k8sIntgToOsPatchPortName()).build();
    ifaceConfig.addPatchMode(k8sNode.osToK8sIntgPatchPortName(), osIntK8sIntPatchDesc);
    // openstack integration bridge -> k8s external bridge
    PatchDescription osIntK8sExPatchDesc = DefaultPatchDescription.builder().deviceId(OS_INTEGRATION_BRIDGE).ifaceName(k8sNode.osToK8sExtPatchPortName()).peer(k8sNode.k8sExtToOsPatchPortName()).build();
    ifaceConfig.addPatchMode(k8sNode.osToK8sExtPatchPortName(), osIntK8sExPatchDesc);
}
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 3 with InterfaceConfig

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

the class DefaultKubevirtNodeHandler method createPhysicalPatchPorts.

private void createPhysicalPatchPorts(KubevirtNode node, KubevirtPhyInterface phyInterface) {
    Device device = deviceService.getDevice(node.ovsdb());
    if (device == null || !device.is(InterfaceConfig.class)) {
        log.error("Failed to create patch interface on {}", node.ovsdb());
        return;
    }
    String physicalDeviceId = BRIDGE_PREFIX + phyInterface.network();
    String intToPhyPatchPort = structurePortName(INTEGRATION_TO_PHYSICAL_PREFIX + phyInterface.network());
    String phyToIntPatchPort = structurePortName(phyInterface.network() + PHYSICAL_TO_INTEGRATION_SUFFIX);
    // integration bridge -> physical bridge
    PatchDescription intToPhyPatchDesc = DefaultPatchDescription.builder().deviceId(INTEGRATION_BRIDGE).ifaceName(intToPhyPatchPort).peer(phyToIntPatchPort).build();
    // physical bridge -> integration bridge
    PatchDescription phyToIntPatchDesc = DefaultPatchDescription.builder().deviceId(physicalDeviceId).ifaceName(phyToIntPatchPort).peer(intToPhyPatchPort).build();
    InterfaceConfig ifaceConfig = device.as(InterfaceConfig.class);
    ifaceConfig.addPatchMode(INTEGRATION_TO_PHYSICAL_PREFIX + phyInterface.network(), intToPhyPatchDesc);
    ifaceConfig.addPatchMode(phyInterface.network() + PHYSICAL_TO_INTEGRATION_SUFFIX, phyToIntPatchDesc);
    addOrRemoveSystemInterface(node, physicalDeviceId, phyInterface.intf(), deviceService, true);
}
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 4 with InterfaceConfig

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

the class DefaultKubevirtNodeHandler method removePhysicalPatchPorts.

private void removePhysicalPatchPorts(KubevirtNode node, String network) {
    Device device = deviceService.getDevice(node.ovsdb());
    if (device == null || !device.is(InterfaceConfig.class)) {
        log.error("Failed to remove patch interface on {}", node.ovsdb());
        return;
    }
    String intToPhyPatchPort = structurePortName(INTEGRATION_TO_PHYSICAL_PREFIX + network);
    InterfaceConfig ifaceConfig = device.as(InterfaceConfig.class);
    ifaceConfig.removePatchMode(intToPhyPatchPort);
}
Also used : InterfaceConfig(org.onosproject.net.behaviour.InterfaceConfig) Device(org.onosproject.net.Device)

Example 5 with InterfaceConfig

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

the class DefaultKubevirtNodeHandler method createPatchInterfaceBetweenBrIntBrTun.

private void createPatchInterfaceBetweenBrIntBrTun(KubevirtNode node) {
    Device device = deviceService.getDevice(node.ovsdb());
    if (device == null || !device.is(InterfaceConfig.class)) {
        log.error("Failed to create patch interface on {}", node.ovsdb());
        return;
    }
    InterfaceConfig ifaceConfig = device.as(InterfaceConfig.class);
    // int bridge -> tunnel bridge
    PatchDescription brIntTunPatchDesc = DefaultPatchDescription.builder().deviceId(INTEGRATION_BRIDGE).ifaceName(INTEGRATION_TO_TUNNEL).peer(TUNNEL_TO_INTEGRATION).build();
    ifaceConfig.addPatchMode(INTEGRATION_TO_TUNNEL, brIntTunPatchDesc);
    // tunnel bridge -> int bridge
    PatchDescription brTunIntPatchDesc = DefaultPatchDescription.builder().deviceId(TUNNEL_BRIDGE).ifaceName(TUNNEL_TO_INTEGRATION).peer(INTEGRATION_TO_TUNNEL).build();
    ifaceConfig.addPatchMode(TUNNEL_TO_INTEGRATION, 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