use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteMcastMacsBuilder in project netvirt by opendaylight.
the class RemoteMcastCmd method transform.
@Override
public RemoteMcastMacs transform(InstanceIdentifier<Node> nodePath, RemoteMcastMacs src) {
RemoteMcastMacsBuilder ucmlBuilder = new RemoteMcastMacsBuilder(src);
List<LocatorSet> locatorSet = new ArrayList<>();
for (LocatorSet locator : src.getLocatorSet()) {
locatorSet.add(new LocatorSetBuilder().setLocatorRef(HwvtepHAUtil.buildLocatorRef(nodePath, HwvtepHAUtil.getTepIpVal(locator.getLocatorRef()))).build());
}
ucmlBuilder.setLocatorSet(locatorSet);
ucmlBuilder.setLogicalSwitchRef(HwvtepHAUtil.convertLogicalSwitchRef(src.getLogicalSwitchRef(), nodePath));
ucmlBuilder.setMacEntryUuid(HwvtepHAUtil.getUUid(src.getMacEntryKey().getValue()));
RemoteMcastMacsKey key = new RemoteMcastMacsKey(ucmlBuilder.getLogicalSwitchRef(), ucmlBuilder.getMacEntryKey());
ucmlBuilder.setKey(key);
return ucmlBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteMcastMacsBuilder in project netvirt by opendaylight.
the class DhcpExternalTunnelManager method createRemoteMcastMac.
public RemoteMcastMacs createRemoteMcastMac(Node dstDevice, String logicalSwitchName, IpAddress internalTunnelIp) {
Set<LocatorSet> locators = new HashSet<>();
TerminationPointKey terminationPointKey = HwvtepSouthboundUtils.getTerminationPointKey(internalTunnelIp.getIpv4Address().getValue());
HwvtepPhysicalLocatorRef phyLocRef = new HwvtepPhysicalLocatorRef(HwvtepSouthboundUtils.createInstanceIdentifier(dstDevice.getNodeId()).child(TerminationPoint.class, terminationPointKey));
locators.add(new LocatorSetBuilder().setLocatorRef(phyLocRef).build());
HwvtepLogicalSwitchRef lsRef = new HwvtepLogicalSwitchRef(HwvtepSouthboundUtils.createLogicalSwitchesInstanceIdentifier(dstDevice.getNodeId(), new HwvtepNodeName(logicalSwitchName)));
RemoteMcastMacs remoteMcastMacs = new RemoteMcastMacsBuilder().setMacEntryKey(new MacAddress(UNKNOWN_DMAC)).setLogicalSwitchRef(lsRef).build();
InstanceIdentifier<RemoteMcastMacs> iid = HwvtepSouthboundUtils.createRemoteMcastMacsInstanceIdentifier(dstDevice.getNodeId(), remoteMcastMacs.getKey());
ReadOnlyTransaction transaction = broker.newReadOnlyTransaction();
try {
// TODO do async mdsal read
remoteMcastMacs = transaction.read(LogicalDatastoreType.CONFIGURATION, iid).checkedGet().get();
locators.addAll(remoteMcastMacs.getLocatorSet());
return new RemoteMcastMacsBuilder(remoteMcastMacs).setLocatorSet(new ArrayList<>(locators)).build();
} catch (ReadFailedException e) {
LOG.error("Failed to read the macs {}", iid);
}
return null;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteMcastMacsBuilder in project genius by opendaylight.
the class HwvtepSouthboundUtils method createRemoteMcastMac.
/**
* Creates the remote mcast mac.
*
* @param nodeId
* the node id
* @param mac
* the mac
* @param ipAddress
* the ip address
* @param logicalSwitchName
* the logical switch name
* @param lstPhysicalLocatorAug
* the lst physical locator aug
* @return the remote mcast macs
*/
public static RemoteMcastMacs createRemoteMcastMac(NodeId nodeId, String mac, IpAddress ipAddress, String logicalSwitchName, List<HwvtepPhysicalLocatorAugmentation> lstPhysicalLocatorAug) {
HwvtepLogicalSwitchRef lsRef = new HwvtepLogicalSwitchRef(createLogicalSwitchesInstanceIdentifier(nodeId, new HwvtepNodeName(logicalSwitchName)));
List<LocatorSet> lstLocatorSet = new ArrayList<>();
for (HwvtepPhysicalLocatorAugmentation phyLocatorAug : lstPhysicalLocatorAug) {
HwvtepPhysicalLocatorRef phyLocRef = new HwvtepPhysicalLocatorRef(createPhysicalLocatorInstanceIdentifier(nodeId, phyLocatorAug));
lstLocatorSet.add(new LocatorSetBuilder().setLocatorRef(phyLocRef).build());
}
RemoteMcastMacs remoteMcastMacs = new RemoteMcastMacsBuilder().setMacEntryKey(new MacAddress(mac)).setIpaddr(ipAddress).setLogicalSwitchRef(lsRef).setLocatorSet(lstLocatorSet).build();
return remoteMcastMacs;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteMcastMacsBuilder in project netvirt by opendaylight.
the class ElanL2GatewayMulticastUtils method putRemoteMcastMac.
/**
* Put remote mcast mac in config DS.
*
* @param nodeId
* the node id
* @param logicalSwitchName
* the logical switch name
* @param tepIps
* the tep ips
*/
private static void putRemoteMcastMac(NodeId nodeId, String logicalSwitchName, ArrayList<IpAddress> tepIps) {
List<LocatorSet> locators = new ArrayList<>();
for (IpAddress tepIp : tepIps) {
HwvtepPhysicalLocatorAugmentation phyLocatorAug = HwvtepSouthboundUtils.createHwvtepPhysicalLocatorAugmentation(String.valueOf(tepIp.getValue()));
HwvtepPhysicalLocatorRef phyLocRef = new HwvtepPhysicalLocatorRef(HwvtepSouthboundUtils.createPhysicalLocatorInstanceIdentifier(nodeId, phyLocatorAug));
locators.add(new LocatorSetBuilder().setLocatorRef(phyLocRef).build());
}
HwvtepLogicalSwitchRef lsRef = new HwvtepLogicalSwitchRef(HwvtepSouthboundUtils.createLogicalSwitchesInstanceIdentifier(nodeId, new HwvtepNodeName(logicalSwitchName)));
RemoteMcastMacs remoteMcastMac = new RemoteMcastMacsBuilder().setMacEntryKey(new MacAddress(ElanConstants.UNKNOWN_DMAC)).setLogicalSwitchRef(lsRef).setLocatorSet(locators).build();
InstanceIdentifier<RemoteMcastMacs> iid = HwvtepSouthboundUtils.createRemoteMcastMacsInstanceIdentifier(nodeId, remoteMcastMac.getKey());
ResourceBatchingManager.getInstance().put(ResourceBatchingManager.ShardResource.CONFIG_TOPOLOGY, iid, remoteMcastMac);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteMcastMacsBuilder in project netvirt by opendaylight.
the class TestBuilders method buildRemoteMcastMacs.
public static RemoteMcastMacs buildRemoteMcastMacs(InstanceIdentifier<Node> iid, String mac, String logicalSwitchName, String[] tepIps) {
RemoteMcastMacsBuilder remoteMcastMacsBuilder = new RemoteMcastMacsBuilder();
if (mac.equals("unknown-dst")) {
remoteMcastMacsBuilder.setMacEntryKey(new MacAddress("00:00:00:00:00:00"));
} else {
remoteMcastMacsBuilder.setMacEntryKey(new MacAddress(mac));
}
remoteMcastMacsBuilder.setMacEntryUuid(getUUid(mac));
// mMacLocalBuilder.setIpaddr(new IpAddress(ip.toCharArray()));
remoteMcastMacsBuilder.setLogicalSwitchRef(buildLogicalSwitchesRef(iid, logicalSwitchName));
List<LocatorSet> locatorSets = new ArrayList<>();
for (String tepIp : tepIps) {
locatorSets.add(new LocatorSetBuilder().setLocatorRef(buildLocatorRef(iid, tepIp)).build());
}
remoteMcastMacsBuilder.setLocatorSet(locatorSets);
return remoteMcastMacsBuilder.build();
}
Aggregations