Search in sources :

Example 1 with Subnetmap

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap in project netvirt by opendaylight.

the class SubnetmapChangeListener method add.

@Override
protected void add(InstanceIdentifier<Subnetmap> identifier, Subnetmap subnetmap) {
    LOG.debug("SubnetmapChangeListener add subnetmap method - key: {}, value: {}", identifier, subnetmap);
    Uuid subnetId = subnetmap.getId();
    Network network = VpnUtil.getNeutronNetwork(dataBroker, subnetmap.getNetworkId());
    if (network == null) {
        LOG.error("SubnetMapChangeListener:add: network was not found for subnetId {}", subnetId.getValue());
        return;
    }
    if (VpnUtil.getIsExternal(network)) {
        LOG.debug("SubnetmapListener:add: provider subnetwork {} is handling in " + "ExternalSubnetVpnInstanceListener", subnetId.getValue());
        return;
    }
    String elanInstanceName = subnetmap.getNetworkId().getValue();
    long elanTag = getElanTag(elanInstanceName);
    if (elanTag == 0L) {
        LOG.error("SubnetMapChangeListener:add: unable to fetch elantag from ElanInstance {} for subnet {}", elanInstanceName, subnetId.getValue());
        return;
    }
    if (subnetmap.getVpnId() != null) {
        boolean isBgpVpn = !subnetmap.getVpnId().equals(subnetmap.getRouterId());
        LOG.info("SubnetMapChangeListener:add: subnetmap {} with elanTag {} to VPN {}", subnetmap, elanTag, subnetmap.getVpnId());
        vpnSubnetRouteHandler.onSubnetAddedToVpn(subnetmap, isBgpVpn, elanTag);
    }
}
Also used : Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) Network(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network)

Example 2 with Subnetmap

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap in project netvirt by opendaylight.

the class VpnHelper method getSubnetmapFromItsUuid.

/**
 * Get Subnetmap from its Uuid.
 * @param broker the data broker for look for data
 * @param subnetUuid the subnet's Uuid
 * @return the Subnetmap of Uuid or null if it is not found
 */
public static Subnetmap getSubnetmapFromItsUuid(DataBroker broker, Uuid subnetUuid) {
    Subnetmap sn = null;
    InstanceIdentifier<Subnetmap> id = buildSubnetmapIdentifier(subnetUuid);
    Optional<Subnetmap> optionalSn = read(broker, LogicalDatastoreType.CONFIGURATION, id);
    if (optionalSn.isPresent()) {
        sn = optionalSn.get();
    }
    return sn;
}
Also used : Subnetmap(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap)

Example 3 with Subnetmap

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap in project netvirt by opendaylight.

the class ExternalNetworkGroupInstaller method installExtNetGroupEntries.

public void installExtNetGroupEntries(Uuid subnetId, String macAddress) {
    Subnetmap subnetMap = NatUtil.getSubnetMap(broker, subnetId);
    if (subnetMap == null) {
        LOG.error("installExtNetGroupEntries : Subnetmap is null");
        return;
    }
    if (NatUtil.isIPv6Subnet(subnetMap.getSubnetIp())) {
        LOG.debug("installExtNetGroupEntries : Subnet-id {} is not an IPv4 subnet, hence skipping.", subnetMap.getId());
        return;
    }
    installExtNetGroupEntries(subnetMap, macAddress);
}
Also used : Subnetmap(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap)

Example 4 with Subnetmap

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap in project netvirt by opendaylight.

the class ExternalSubnetVpnInstanceListener method invokeSubnetDeletedFromVpn.

private void invokeSubnetDeletedFromVpn(String externalSubnetId) {
    Uuid externalSubnetUuid = new Uuid(externalSubnetId);
    Subnetmap subnetMap = NatUtil.getSubnetMap(dataBroker, externalSubnetUuid);
    vpnManager.onSubnetDeletedFromVpn(subnetMap, false);
}
Also used : Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) Subnetmap(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap)

Example 5 with Subnetmap

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap in project netvirt by opendaylight.

the class ExternalSubnetVpnInstanceListener method invokeSubnetAddedToVpn.

private void invokeSubnetAddedToVpn(String externalSubnetId) {
    Uuid externalSubnetUuid = new Uuid(externalSubnetId);
    Subnetmap subnetMap = NatUtil.getSubnetMap(dataBroker, externalSubnetUuid);
    if (subnetMap == null) {
        LOG.error("invokeSubnetAddedToVpn : Cannot invoke onSubnetAddedToVpn for subnet-id {} in vpn-id {}" + " due to this subnet missing in Subnetmap model", externalSubnetUuid, externalSubnetId);
        return;
    }
    ElanInstance elanInstance = elanService.getElanInstance(subnetMap.getNetworkId().getValue());
    vpnManager.onSubnetAddedToVpn(subnetMap, false, elanInstance.getElanTag());
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) Subnetmap(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap)

Aggregations

Subnetmap (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap)50 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)47 ArrayList (java.util.ArrayList)20 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)15 SubnetmapKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.SubnetmapKey)12 TransactionCommitFailedException (org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException)11 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)10 IpVersionChoice (org.opendaylight.netvirt.neutronvpn.api.enums.IpVersionChoice)9 Network (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network)9 SubnetOpDataEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnet.op.data.SubnetOpDataEntry)8 HashSet (java.util.HashSet)7 SubnetOpDataEntryKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnet.op.data.SubnetOpDataEntryKey)7 Subnetmaps (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.Subnetmaps)7 SubnetmapBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.SubnetmapBuilder)7 FixedIps (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIps)7 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)5 SubnetOpDataEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnet.op.data.SubnetOpDataEntryBuilder)5 Router (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.routers.Router)5 BigInteger (java.math.BigInteger)4 HashMap (java.util.HashMap)4