Update for supporting the new aux-locations API
Pushing the right aux-location (ASG connect point) using the new aux-location APIs when creating a new Host for an Attachment.
Also, updates to be compatible with last modification to BngProgrammable APIs.
Change-Id: I1841efc1a5338d90de38729083531eb46f49d814
diff --git a/app/src/main/java/org/opencord/bng/impl/BngManager.java b/app/src/main/java/org/opencord/bng/impl/BngManager.java
index 1f399e1..fa5c755 100644
--- a/app/src/main/java/org/opencord/bng/impl/BngManager.java
+++ b/app/src/main/java/org/opencord/bng/impl/BngManager.java
@@ -253,22 +253,19 @@
ConnectPoint asgConnectPoint,
ConnectPoint oltConnectPoint,
String onuSerialNumber) {
-// Set<HostLocation> hostLocation = Set.of(new HostLocation(oltConnectPoint.deviceId(),
-// oltConnectPoint.port(),
-// System.currentTimeMillis()));
-// var auxLocation = String.join(",", asgConnectPoint.toString());
- // FIXME: remove this hostLocation and decomment the above rows when aux-location patch will be merged
- Set<HostLocation> hostLocation = Set.of(new HostLocation(asgConnectPoint.deviceId(),
- asgConnectPoint.port(),
+ Set<HostLocation> hostLocation = Set.of(new HostLocation(oltConnectPoint.deviceId(),
+ oltConnectPoint.port(),
System.currentTimeMillis()));
+ Set<HostLocation> auxLocation = Set.of(new HostLocation(asgConnectPoint.deviceId(),
+ asgConnectPoint.port(),
+ System.currentTimeMillis()));
var annotations = DefaultAnnotations.builder()
-// .set(AUX_LOCATIONS_ANNOTATION, auxLocation)
.set(ONU_ANNOTATION, onuSerialNumber)
.build();
Set<IpAddress> ips = hostIp != null
? ImmutableSet.of(hostIp) : ImmutableSet.of();
return new DefaultHostDescription(hostMac, sTag,
- hostLocation,
+ hostLocation, auxLocation,
ips, cTag, EthType.EtherType.QINQ.ethType(),
false, annotations);
}
@@ -287,7 +284,11 @@
// Try to remove host even if the BNG user plane device is not available
hostProviderService.hostVanished(hostToBeRemoved);
if (bngProgrammableAvailable()) {
- bngProgrammable.removeAttachment(regAttachment);
+ try {
+ bngProgrammable.removeAttachment(regAttachment);
+ } catch (BngProgrammableException ex) {
+ log.error("Exception when removing the attachment: " + ex.getMessage());
+ }
} else {
log.info("BNG user plane not available!");
}