+ for (UcastMacsRemote ucastMacsRemote : updatedUMacsRemoteRows.values()) {
+ updateUcastMacsRemote(transaction, ucastMacsRemote);
+ }
+ }
+
+ private void updateUcastMacsRemote(ReadWriteTransaction transaction, UcastMacsRemote ucastMacsRemote) {
+ final InstanceIdentifier<Node> connectionIId = getOvsdbConnectionInstance().getInstanceIdentifier();
+ Optional<Node> connection = HwvtepSouthboundUtil.readNode(transaction, connectionIId);
+ if (connection.isPresent()) {
+ Node connectionNode = buildConnectionNode(ucastMacsRemote);
+ transaction.merge(LogicalDatastoreType.OPERATIONAL, connectionIId, connectionNode);
+ //TODO: Handle any deletes
+ }
+ }
+
+ private Node buildConnectionNode(UcastMacsRemote uMacRemote) {
+ NodeBuilder connectionNode = new NodeBuilder();
+ connectionNode.setNodeId(getOvsdbConnectionInstance().getNodeId());
+ InstanceIdentifier<Node> nodeIid = getOvsdbConnectionInstance().getInstanceIdentifier();
+ HwvtepGlobalAugmentationBuilder hgAugmentationBuilder = new HwvtepGlobalAugmentationBuilder();
+ List<RemoteUcastMacs> remoteUMacs = new ArrayList<>();
+ RemoteUcastMacsBuilder rumBuilder = new RemoteUcastMacsBuilder();
+ rumBuilder.setMacEntryKey(new MacAddress(uMacRemote.getMac()));
+ if (uMacRemote.getIpAddr() != null && !uMacRemote.getIpAddr().isEmpty()) {
+ rumBuilder.setIpaddr(new IpAddress(uMacRemote.getIpAddr().toCharArray()));
+ }
+ if (uMacRemote.getLocatorColumn() != null
+ && uMacRemote.getLocatorColumn().getData() != null) {
+ UUID pLocUUID = uMacRemote.getLocatorColumn().getData();
+ PhysicalLocator physicalLocator = updatedPLocRows.get(pLocUUID);
+ if (physicalLocator != null) {
+ InstanceIdentifier<TerminationPoint> plIid = HwvtepSouthboundMapper.createInstanceIdentifier(nodeIid,
+ physicalLocator);
+ rumBuilder.setLocatorRef(new HwvtepPhysicalLocatorRef(plIid));
+ }
+ }
+ if (uMacRemote.getLogicalSwitchColumn() != null
+ && uMacRemote.getLogicalSwitchColumn().getData() != null) {
+ UUID lsUUID = uMacRemote.getLogicalSwitchColumn().getData();
+ final LogicalSwitch logicalSwitch = updatedLSRows.get(lsUUID);
+ if (logicalSwitch != null) {
+ InstanceIdentifier<LogicalSwitches> lSwitchIid =
+ HwvtepSouthboundMapper.createInstanceIdentifier(getOvsdbConnectionInstance(), logicalSwitch);
+ rumBuilder.setLogicalSwitchRef(new HwvtepLogicalSwitchRef(lSwitchIid));
+ }
+ }
+ remoteUMacs.add(rumBuilder.build());
+ hgAugmentationBuilder.setRemoteUcastMacs(remoteUMacs);
+ connectionNode.addAugmentation(HwvtepGlobalAugmentation.class, hgAugmentationBuilder.build());
+ return connectionNode.build();