Search in sources :

Example 1 with RouterIdsKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.router.id.name.RouterIdsKey in project netvirt by opendaylight.

the class ExternalRoutersListener method addOrDelDefFibRouteToSNAT.

private void addOrDelDefFibRouteToSNAT(String routerName, long routerId, long bgpVpnId, Uuid bgpVpnUuid, boolean create, WriteTransaction writeFlowInvTx) {
    // Check if BGP VPN exists. If exists then invoke the new method.
    if (bgpVpnId != NatConstants.INVALID_ID) {
        if (bgpVpnUuid != null) {
            String bgpVpnName = bgpVpnUuid.getValue();
            LOG.debug("Populate the router-id-name container with the mapping BGP VPN-ID {} -> BGP VPN-NAME {}", bgpVpnId, bgpVpnName);
            RouterIds rtrs = new RouterIdsBuilder().setKey(new RouterIdsKey(bgpVpnId)).setRouterId(bgpVpnId).setRouterName(bgpVpnName).build();
            MDSALUtil.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION, getRoutersIdentifier(bgpVpnId), rtrs);
        }
        addOrDelDefaultFibRouteForSnatWithBgpVpn(routerName, routerId, bgpVpnId, create, writeFlowInvTx);
        return;
    }
    // Router ID is used as the internal VPN's name, hence the vrf-id in VpnInstance Op DataStore
    addOrDelDefaultFibRouteForSNAT(routerName, routerId, create, writeFlowInvTx);
}
Also used : RouterIds(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.router.id.name.RouterIds) RouterIdsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.router.id.name.RouterIdsKey) RouterIdsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.router.id.name.RouterIdsBuilder)

Example 2 with RouterIdsKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.router.id.name.RouterIdsKey in project netvirt by opendaylight.

the class ExternalRoutersListener method changeLocalVpnIdToBgpVpnId.

/**
 * router association to vpn.
 *
 * @param routerName - Name of router
 * @param routerId - router id
 * @param bgpVpnName BGP VPN name
 */
public void changeLocalVpnIdToBgpVpnId(String routerName, long routerId, String bgpVpnName, WriteTransaction writeFlowInvTx, ProviderTypes extNwProvType) {
    LOG.debug("changeLocalVpnIdToBgpVpnId : Router associated to BGP VPN");
    if (chkExtRtrAndSnatEnbl(new Uuid(routerName))) {
        long bgpVpnId = NatUtil.getVpnId(dataBroker, bgpVpnName);
        LOG.debug("changeLocalVpnIdToBgpVpnId : BGP VPN ID value {} ", bgpVpnId);
        if (bgpVpnId != NatConstants.INVALID_ID) {
            LOG.debug("changeLocalVpnIdToBgpVpnId : Populate the router-id-name container with the " + "mapping BGP VPN-ID {} -> BGP VPN-NAME {}", bgpVpnId, bgpVpnName);
            RouterIds rtrs = new RouterIdsBuilder().setKey(new RouterIdsKey(bgpVpnId)).setRouterId(bgpVpnId).setRouterName(bgpVpnName).build();
            MDSALUtil.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION, getRoutersIdentifier(bgpVpnId), rtrs);
            // Get the allocated Primary NAPT Switch for this router
            LOG.debug("changeLocalVpnIdToBgpVpnId : Router ID value {} ", routerId);
            LOG.debug("changeLocalVpnIdToBgpVpnId : Update the Router ID {} to the BGP VPN ID {} ", routerId, bgpVpnId);
            addOrDelDefaultFibRouteForSnatWithBgpVpn(routerName, routerId, bgpVpnId, true, writeFlowInvTx);
            // Get the group ID
            BigInteger primarySwitchId = NatUtil.getPrimaryNaptfromRouterName(dataBroker, routerName);
            createGroupId(getGroupIdKey(routerName));
            installFlowsWithUpdatedVpnId(primarySwitchId, routerName, bgpVpnId, routerId, true, writeFlowInvTx, extNwProvType);
        }
    }
}
Also used : RouterIds(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.router.id.name.RouterIds) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) RouterIdsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.router.id.name.RouterIdsKey) BigInteger(java.math.BigInteger) RouterIdsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.router.id.name.RouterIdsBuilder)

Example 3 with RouterIdsKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.router.id.name.RouterIdsKey in project netvirt by opendaylight.

the class NatUtil method createRouterIdsConfigDS.

static void createRouterIdsConfigDS(DataBroker dataBroker, long routerId, String routerName) {
    if (routerId == NatConstants.INVALID_ID) {
        LOG.error("createRouterIdsConfigDS : invalid routerId for routerName {}", routerName);
        return;
    }
    RouterIds rtrs = new RouterIdsBuilder().setKey(new RouterIdsKey(routerId)).setRouterId(routerId).setRouterName(routerName).build();
    MDSALUtil.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION, buildRouterIdentifier(routerId), rtrs);
}
Also used : RouterIds(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.router.id.name.RouterIds) RouterIdsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.router.id.name.RouterIdsKey) RouterIdsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.router.id.name.RouterIdsBuilder)

Aggregations

RouterIds (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.router.id.name.RouterIds)3 RouterIdsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.router.id.name.RouterIdsBuilder)3 RouterIdsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.router.id.name.RouterIdsKey)3 BigInteger (java.math.BigInteger)1 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)1