Search in sources :

Example 11 with InterfaceConfig

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

the class KubevirtNetworkHandler method removePatchInterface.

private void removePatchInterface(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 tunToIntIntf = TUNNEL_TO_TENANT_PREFIX + segmentIdHex(network.segmentId());
    ifaceConfig.removePatchMode(tunToIntIntf);
}
Also used : InterfaceConfig(org.onosproject.net.behaviour.InterfaceConfig) Device(org.onosproject.net.Device)

Example 12 with InterfaceConfig

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

Example 13 with InterfaceConfig

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

the class DefaultKubevirtNodeHandler method createTunnelInterface.

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

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

the class DefaultOpenstackNodeHandler method removePhysicalPatchPorts.

private void removePhysicalPatchPorts(OpenstackNode osNode, String network) {
    Device device = deviceService.getDevice(osNode.ovsdb());
    if (device == null || !device.is(InterfaceConfig.class)) {
        log.error("Failed to remove patch interface on {}", osNode.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 15 with InterfaceConfig

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

the class DefaultOpenstackNodeHandler method createTunnelInterface.

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

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