Search in sources :

Example 36 with IpAddress

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.endpoint.endpoint.type.IpAddress in project netvirt by opendaylight.

the class TransportZoneNotificationUtil method addVtep.

/**
 * Tries to add a vtep for a transport zone.
 *
 * @return Whether a vtep was added or not.
 */
private boolean addVtep(TransportZone zone, String subnetIp, BigInteger dpnId, @Nullable String localIp) {
    List<Subnets> zoneSubnets = zone.getSubnets();
    if (zoneSubnets == null) {
        return false;
    }
    Subnets subnets = getOrAddSubnet(zoneSubnets, subnetIp);
    for (Vteps existingVtep : subnets.getVteps()) {
        if (existingVtep.getDpnId().equals(dpnId)) {
            return false;
        }
    }
    if (localIp != null) {
        IpAddress nodeIp = new IpAddress(localIp.toCharArray());
        VtepsBuilder vtepsBuilder = new VtepsBuilder().setDpnId(dpnId).setIpAddress(nodeIp).setPortname(TUNNEL_PORT).setOptionOfTunnel(elanConfig.isUseOfTunnels());
        subnets.getVteps().add(vtepsBuilder.build());
        return true;
    }
    return false;
}
Also used : Subnets(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.Subnets) Vteps(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.Vteps) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) VtepsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.VtepsBuilder)

Example 37 with IpAddress

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.endpoint.endpoint.type.IpAddress in project netvirt by opendaylight.

the class NodeConnectedHandlerUtils method addPsNode.

CheckedFuture<Void, TransactionCommitFailedException> addPsNode(InstanceIdentifier<Node> path, InstanceIdentifier<Node> parentPath, List<String> portNameList, WriteTransaction transaction) throws Exception {
    NodeBuilder nodeBuilder = null;
    nodeBuilder = prepareOperationalNode(path);
    PhysicalSwitchAugmentationBuilder physicalSwitchAugmentationBuilder = new PhysicalSwitchAugmentationBuilder();
    physicalSwitchAugmentationBuilder.setManagedBy(new HwvtepGlobalRef(parentPath));
    physicalSwitchAugmentationBuilder.setPhysicalSwitchUuid(getUUid("d1s3"));
    physicalSwitchAugmentationBuilder.setHwvtepNodeName(new HwvtepNodeName("s3"));
    physicalSwitchAugmentationBuilder.setHwvtepNodeDescription("description");
    List<TunnelIps> tunnelIps = new ArrayList<>();
    IpAddress ip = new IpAddress("192.168.122.30".toCharArray());
    tunnelIps.add(new TunnelIpsBuilder().setKey(new TunnelIpsKey(ip)).setTunnelIpsKey(ip).build());
    physicalSwitchAugmentationBuilder.setTunnelIps(tunnelIps);
    nodeBuilder.addAugmentation(PhysicalSwitchAugmentation.class, physicalSwitchAugmentationBuilder.build());
    PhysicalSwitchHelper.dId = parentPath;
    nodeBuilder.setTerminationPoint(PhysicalSwitchHelper.addPhysicalSwitchTerminationPoints(path, transaction, portNameList));
    return TestUtil.submitNode(OPERATIONAL, path, nodeBuilder.build(), transaction);
}
Also used : PhysicalSwitchAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.PhysicalSwitchAugmentationBuilder) TunnelIpsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelIpsBuilder) TunnelIpsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelIpsKey) TunnelIps(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelIps) HwvtepGlobalRef(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalRef) ArrayList(java.util.ArrayList) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) HwvtepNodeName(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepNodeName) NodeBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder)

Example 38 with IpAddress

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.endpoint.endpoint.type.IpAddress in project netvirt by opendaylight.

the class TestBuilders method buildLocalMcastMacs.

public static LocalMcastMacs buildLocalMcastMacs(InstanceIdentifier<Node> iid, String mac, String logicalSwitchName, String tepIp) {
    LocalMcastMacsBuilder localMcastMacsBuilder = new LocalMcastMacsBuilder();
    if (mac.equals("unknown-dst")) {
        localMcastMacsBuilder.setMacEntryKey(new MacAddress("00:00:00:00:00:00"));
    } else {
        localMcastMacsBuilder.setMacEntryKey(new MacAddress(mac));
    }
    localMcastMacsBuilder.setMacEntryUuid(getUUid(mac));
    // mMacLocalBuilder.setIpaddr(new IpAddress(ip.toCharArray()));
    localMcastMacsBuilder.setLogicalSwitchRef(buildLogicalSwitchesRef(iid, logicalSwitchName));
    List<LocatorSet> locatorSets = new ArrayList<>();
    locatorSets.add(new LocatorSetBuilder().setLocatorRef(buildLocatorRef(iid, tepIp)).build());
    localMcastMacsBuilder.setLocatorSet(locatorSets);
    return localMcastMacsBuilder.build();
}
Also used : LocatorSet(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical.locator.set.attributes.LocatorSet) ArrayList(java.util.ArrayList) LocalMcastMacsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalMcastMacsBuilder) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) LocatorSetBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical.locator.set.attributes.LocatorSetBuilder)

Example 39 with IpAddress

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.endpoint.endpoint.type.IpAddress in project netvirt by opendaylight.

the class TestBuilders method buildTerminationPoint.

public static TerminationPoint buildTerminationPoint(InstanceIdentifier<Node> nodeIid, String ip) {
    TerminationPointKey tpKey = new TerminationPointKey(new TpId("vxlan_over_ipv4:" + ip));
    TerminationPointBuilder tpBuilder = new TerminationPointBuilder();
    if (nodeIid != null && tpKey != null) {
        tpBuilder.setKey(tpKey);
        tpBuilder.setTpId(tpKey.getTpId());
        InstanceIdentifier<TerminationPoint> tpPath = buildTpId(nodeIid, ip);
        HwvtepPhysicalLocatorAugmentationBuilder tpAugmentationBuilder = new HwvtepPhysicalLocatorAugmentationBuilder();
        tpAugmentationBuilder.setPhysicalLocatorUuid(getUUid(ip));
        tpAugmentationBuilder.setEncapsulationType(createEncapsulationType("vxlan_over_ipv4"));
        tpAugmentationBuilder.setDstIp(new IpAddress(ip.toCharArray()));
        tpBuilder.addAugmentation(HwvtepPhysicalLocatorAugmentation.class, tpAugmentationBuilder.build());
    }
    return tpBuilder.build();
}
Also used : TpId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId) HwvtepPhysicalLocatorAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalLocatorAugmentationBuilder) TerminationPointKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) TerminationPointBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder) TerminationPoint(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint)

Example 40 with IpAddress

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.endpoint.endpoint.type.IpAddress in project netvirt by opendaylight.

the class IfMgr method addHostIntf.

public void addHostIntf(Uuid portId, Uuid snetId, Uuid networkId, IpAddress fixedIp, String macAddress, String deviceOwner) {
    LOG.debug("addHostIntf portId {}, snetId {}, networkId {}, ip {}, mac {}", portId, snetId, networkId, fixedIp, macAddress);
    // Save the interface ipv6 address in its fully expanded format
    Ipv6Address addr = new Ipv6Address(InetAddresses.forString(fixedIp.getIpv6Address().getValue()).getHostAddress());
    fixedIp = new IpAddress(addr);
    VirtualPort intf = VirtualPort.builder().intfUUID(portId).networkID(networkId).macAddress(macAddress).routerIntfFlag(false).deviceOwner(deviceOwner).build();
    intf.setSubnetInfo(snetId, fixedIp);
    VirtualPort prevIntf = vintfs.putIfAbsent(portId, intf);
    if (prevIntf == null) {
        Long elanTag = getNetworkElanTag(networkId);
        // Do service binding for the port and set the serviceBindingStatus to true.
        ipv6ServiceUtils.bindIpv6Service(portId.getValue(), elanTag, NwConstants.IPV6_TABLE);
        intf.setServiceBindingStatus(true);
        /* Update the intf dpnId/ofPort from the Operational Store */
        updateInterfaceDpidOfPortInfo(portId);
    } else {
        intf = prevIntf;
        intf.setSubnetInfo(snetId, fixedIp);
    }
    VirtualSubnet snet = getSubnet(snetId);
    if (snet != null) {
        intf.setSubnet(snetId, snet);
    } else {
        addUnprocessed(unprocessedSubnetIntfs, snetId, intf);
    }
}
Also used : IVirtualPort(org.opendaylight.netvirt.ipv6service.api.IVirtualPort) IVirtualSubnet(org.opendaylight.netvirt.ipv6service.api.IVirtualSubnet) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) Ipv6Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address)

Aggregations

IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)232 ArrayList (java.util.ArrayList)71 Test (org.junit.Test)67 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)67 BigInteger (java.math.BigInteger)47 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)30 ByteBuf (io.netty.buffer.ByteBuf)28 Ipv6Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address)27 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)22 InetAddress (java.net.InetAddress)19 IpPrefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix)19 PhysAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress)19 SimpleAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress)18 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)18 NodeId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId)17 List (java.util.List)14 ExecutionException (java.util.concurrent.ExecutionException)14 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)12 Inet6Address (java.net.Inet6Address)11 PortNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber)11