Search in sources :

Example 1 with DpnToInterfaceBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.underlay.networks.underlay.network.DpnToInterfaceBuilder in project netvirt by opendaylight.

the class PolicyServiceUtil method updateTunnelInterfacesForUnderlayNetwork.

public void updateTunnelInterfacesForUnderlayNetwork(String underlayNetwork, BigInteger srcDpId, List<TunnelInterface> tunnelInterfaces, boolean isAdded) {
    coordinator.enqueueJob(underlayNetwork, () -> {
        InstanceIdentifier<DpnToInterface> identifier = getUnderlayNetworkDpnIdentifier(underlayNetwork, srcDpId);
        WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
        if (isAdded) {
            DpnToInterface dpnToInterface = new DpnToInterfaceBuilder().setDpId(srcDpId).setTunnelInterface(tunnelInterfaces).build();
            tx.merge(LogicalDatastoreType.OPERATIONAL, identifier, dpnToInterface, true);
            LOG.info("Add tunnel interfaces {} on DPN {} to underlay network {}", tunnelInterfaces, srcDpId, underlayNetwork);
        } else {
            tx.delete(LogicalDatastoreType.OPERATIONAL, identifier);
            LOG.info("Remove tunnel interfaces {} from DPN {} on underlay network {}", tunnelInterfaces, srcDpId, underlayNetwork);
        }
        return Collections.singletonList(tx.submit());
    });
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) DpnToInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.underlay.networks.underlay.network.DpnToInterface) DpnToInterfaceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.underlay.networks.underlay.network.DpnToInterfaceBuilder)

Aggregations

WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)1 DpnToInterface (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.underlay.networks.underlay.network.DpnToInterface)1 DpnToInterfaceBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.underlay.networks.underlay.network.DpnToInterfaceBuilder)1