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/api/src/main/java/org/opencord/bng/BngAttachment.java b/api/src/main/java/org/opencord/bng/BngAttachment.java
index 3fce980..77d37e4 100644
--- a/api/src/main/java/org/opencord/bng/BngAttachment.java
+++ b/api/src/main/java/org/opencord/bng/BngAttachment.java
@@ -138,8 +138,6 @@
/**
* Abstract builder of attachments.
- * <p>
- * TODO: javadoc
*/
public abstract static class BngBuilder {
ApplicationId appId;
diff --git a/api/src/main/java/org/opencord/bng/PppoeBngAttachment.java b/api/src/main/java/org/opencord/bng/PppoeBngAttachment.java
index 7d6c8ed..f7ca7be 100644
--- a/api/src/main/java/org/opencord/bng/PppoeBngAttachment.java
+++ b/api/src/main/java/org/opencord/bng/PppoeBngAttachment.java
@@ -49,11 +49,6 @@
return new Builder();
}
- // TODO: remove when BngProgrammable API are updated!
- @Override
- public BngProgrammable.AttachmentId attachmentId() {
- return null;
- }
@Override
public BngProgrammable.Attachment.AttachmentType type() {
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!");
}
diff --git a/app/src/main/java/org/opencord/bng/impl/PppoeHandlerRelay.java b/app/src/main/java/org/opencord/bng/impl/PppoeHandlerRelay.java
index 56566c3..f6c47f3 100644
--- a/app/src/main/java/org/opencord/bng/impl/PppoeHandlerRelay.java
+++ b/app/src/main/java/org/opencord/bng/impl/PppoeHandlerRelay.java
@@ -456,8 +456,6 @@
* @param eth Packet to be modified
*/
private void modPacketForPPPoEServer(Ethernet eth) {
- // TODO: rewrite it. Retrieve information about the interface where
- // PPPoE Server is connected and apply them to the packet
Set<Interface> interfaces = interfaceService.getInterfacesByPort(pppoeRelayConfig.getPppoeServerConnectPoint());
if (interfaces != null &&
interfaces.iterator().hasNext() &&
diff --git a/pom.xml b/pom.xml
index fbf6640..0b5075a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos-dependencies</artifactId>
- <version>2.2.1-b3</version>
+ <version>2.2.1-b4</version>
</parent>
<groupId>org.opencord</groupId>