Search in sources :

Example 6 with PatchDescription

use of org.onosproject.net.behaviour.PatchDescription 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)

Example 7 with PatchDescription

use of org.onosproject.net.behaviour.PatchDescription 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 8 with PatchDescription

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

the class KubevirtNetworkHandler method createPatchTenantInterface.

private void createPatchTenantInterface(KubevirtNode node, KubevirtNetwork network) {
    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);
    String tenantToTunIntf = TENANT_TO_TUNNEL_PREFIX + segmentIdHex(network.segmentId());
    String tunToTenantIntf = TUNNEL_TO_TENANT_PREFIX + segmentIdHex(network.segmentId());
    if (!hasPort(network.tenantDeviceId(node.hostname()), tenantToTunIntf)) {
        // patch ports for tenant bridge -> tunnel bridge
        PatchDescription brTenantTunPatchDesc = DefaultPatchDescription.builder().deviceId(network.tenantBridgeName()).ifaceName(tenantToTunIntf).peer(tunToTenantIntf).build();
        ifaceConfig.addPatchMode(tenantToTunIntf, brTenantTunPatchDesc);
        waitFor(1);
    }
    if (!hasPort(node.tunBridge(), tunToTenantIntf)) {
        // tunnel bridge -> tenant bridge
        PatchDescription brTunTenantPatchDesc = DefaultPatchDescription.builder().deviceId(TUNNEL_BRIDGE).ifaceName(tunToTenantIntf).peer(tenantToTunIntf).build();
        ifaceConfig.addPatchMode(tunToTenantIntf, brTunTenantPatchDesc);
        waitFor(1);
    }
}
Also used : InterfaceConfig(org.onosproject.net.behaviour.InterfaceConfig) Device(org.onosproject.net.Device) PatchDescription(org.onosproject.net.behaviour.PatchDescription) DefaultPatchDescription(org.onosproject.net.behaviour.DefaultPatchDescription)

Aggregations

Device (org.onosproject.net.Device)8 DefaultPatchDescription (org.onosproject.net.behaviour.DefaultPatchDescription)8 InterfaceConfig (org.onosproject.net.behaviour.InterfaceConfig)8 PatchDescription (org.onosproject.net.behaviour.PatchDescription)8