+ public static void deleteBridgeRefEntry(BigInteger dpnId,
+ WriteTransaction tx) {
+ LOG.debug("Deleting bridge ref entry for dpn: {}",
+ dpnId);
+ BridgeRefEntryKey bridgeRefEntryKey = new BridgeRefEntryKey(dpnId);
+ InstanceIdentifier<BridgeRefEntry> bridgeEntryId =
+ InterfaceMetaUtils.getBridgeRefEntryIdentifier(bridgeRefEntryKey);
+ tx.delete(LogicalDatastoreType.OPERATIONAL, bridgeEntryId);
+ }
+
+ public static void createTunnelToInterfaceMap(String tunnelInstanceId,
+ String infName,
+ WriteTransaction transaction) {
+ LOG.debug("creating tunnel instance identifier to interface map for {}",infName);
+ InstanceIdentifier<TunnelInstanceInterface> id = InstanceIdentifier.builder(TunnelInstanceInterfaceMap.class).
+ child(TunnelInstanceInterface.class, new TunnelInstanceInterfaceKey(tunnelInstanceId)).build();
+ TunnelInstanceInterface tunnelInstanceInterface = new TunnelInstanceInterfaceBuilder().
+ setTunnelInstanceIdentifier(tunnelInstanceId).setKey(new TunnelInstanceInterfaceKey(tunnelInstanceId)).setInterfaceName(infName).build();
+ transaction.put(LogicalDatastoreType.OPERATIONAL, id, tunnelInstanceInterface, true);
+
+ }
+
+ public static void createTunnelToInterfaceMap(String infName,InstanceIdentifier<Node> nodeId,
+ WriteTransaction transaction,
+ IfTunnel ifTunnel){
+ InstanceIdentifier<Tunnels> tunnelsInstanceIdentifier = org.opendaylight.vpnservice.interfacemgr.renderer.hwvtep.utilities.SouthboundUtils.
+ createTunnelsInstanceIdentifier(nodeId,
+ ifTunnel.getTunnelSource(), ifTunnel.getTunnelDestination());
+ createTunnelToInterfaceMap(tunnelsInstanceIdentifier.toString(), infName, transaction);
+ }
+
+ public static void removeTunnelToInterfaceMap(InstanceIdentifier<Node> nodeId,
+ WriteTransaction transaction,
+ IfTunnel ifTunnel){
+ InstanceIdentifier<Tunnels> tunnelsInstanceIdentifier = org.opendaylight.vpnservice.interfacemgr.renderer.hwvtep.utilities.SouthboundUtils.
+ createTunnelsInstanceIdentifier(nodeId,
+ ifTunnel.getTunnelSource(), ifTunnel.getTunnelDestination());
+ transaction.delete(LogicalDatastoreType.OPERATIONAL, tunnelsInstanceIdentifier);
+ }
+
+ public static String getInterfaceForTunnelInstanceIdentifier(String tunnelInstanceId,
+ DataBroker dataBroker) {
+ InstanceIdentifier<TunnelInstanceInterface> id = InstanceIdentifier.builder(TunnelInstanceInterfaceMap.class).
+ child(TunnelInstanceInterface.class, new TunnelInstanceInterfaceKey(tunnelInstanceId)).build();
+ Optional<TunnelInstanceInterface> tunnelInstanceInterfaceOptional = IfmUtil.read(LogicalDatastoreType.OPERATIONAL, id, dataBroker);
+ if(tunnelInstanceInterfaceOptional.isPresent()){
+ return tunnelInstanceInterfaceOptional.get().getInterfaceName();
+ }
+ return null;
+ }
+