ONOS dependency is changed; New Version is created for this app; Comments are added to understand the write metadata value
the solution to supporting the authentication flows would be to support using a default Technology Profile (propose using TP ID = 64) The default tech profile 64 would be a single TCONT with a single GEM.
Change-Id: Ic978f099e2546e435bebadce8dee41e4ac38399a
diff --git a/TEST-README.md b/TEST-README.md
index 5dad130..41c49a0 100644
--- a/TEST-README.md
+++ b/TEST-README.md
@@ -27,7 +27,7 @@
onos-app localhost install ~/voltha-projects/sadis/app/target/sadis-app-3.0.0.oar
onos-app localhost activate org.opencord.sadis
-onos-app localhost install ~/voltha-projects/olt/app/target/olt-app-3.0.0-SNAPSHOT.oar
+onos-app localhost install ~/voltha-projects/olt/app/target/olt-app-3.0.1-SNAPSHOT.oar
onos-app localhost activate org.opencord.olt
```
diff --git a/api/pom.xml b/api/pom.xml
index 2c6d6a9..f6d0f9e 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -22,7 +22,7 @@
<parent>
<artifactId>olt</artifactId>
<groupId>org.opencord</groupId>
- <version>3.0.0-SNAPSHOT</version>
+ <version>3.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
diff --git a/app/pom.xml b/app/pom.xml
index e1b9bb0..0ee82ff 100644
--- a/app/pom.xml
+++ b/app/pom.xml
@@ -20,7 +20,7 @@
<parent>
<groupId>org.opencord</groupId>
<artifactId>olt</artifactId>
- <version>3.0.0-SNAPSHOT</version>
+ <version>3.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/app/src/main/java/org/opencord/olt/impl/Olt.java b/app/src/main/java/org/opencord/olt/impl/Olt.java
index a611723..1e00237 100644
--- a/app/src/main/java/org/opencord/olt/impl/Olt.java
+++ b/app/src/main/java/org/opencord/olt/impl/Olt.java
@@ -116,6 +116,8 @@
private static final String APP_NAME = "org.opencord.olt";
private static final short DEFAULT_VLAN = 0;
+ private static final int DEFAULT_TP_ID = 10;
+ private static final String DEFAULT_BP_ID = "Default";
private static final String ADDITIONAL_VLANS = "additional-vlans";
private final Logger log = getLogger(getClass());
@@ -169,6 +171,14 @@
label = "Deleting Meters based on flow count statistics")
protected boolean deleteMeters = false;
+ @Property(name = "defaultTechProfileId", intValue = DEFAULT_TP_ID,
+ label = "Default technology profile id that is used for authentication trap flows")
+ protected int defaultTechProfileId = DEFAULT_TP_ID;
+
+ @Property(name = "defaultBpId", value = DEFAULT_BP_ID,
+ label = "Default bandwidth profile id that is used for authentication trap flows")
+ protected String defaultBpId = DEFAULT_BP_ID;
+
private final DeviceListener deviceListener = new InternalDeviceListener();
private final MeterListener meterListener = new InternalMeterListener();
@@ -258,13 +268,19 @@
}
log.info("DHCP Settings [enableDhcpOnProvisioning: {}, enableDhcpV4: {}, enableDhcpV6: {}]",
- enableDhcpOnProvisioning, enableDhcpV4, enableDhcpV6);
+ enableDhcpOnProvisioning, enableDhcpV4, enableDhcpV6);
Boolean d = Tools.isPropertyEnabled(properties, "deleteMeters");
if (d != null) {
deleteMeters = d;
}
+ String tpId = get(properties, "defaultTechProfileId");
+ defaultTechProfileId = isNullOrEmpty(s) ? DEFAULT_TP_ID : Integer.parseInt(tpId.trim());
+
+ String bpId = get(properties, "defaultBpId");
+ defaultBpId = bpId;
+
} catch (Exception e) {
defaultVlan = DEFAULT_VLAN;
}
@@ -415,7 +431,7 @@
if (getOltInfo(d) == null) {
continue; // not an olt, or not configured in sadis
}
- for (Port p: deviceService.getPorts(d.id())) {
+ for (Port p : deviceService.getPorts(d.id())) {
if (isUniPort(d, p) && p.isEnabled()) {
ConnectPoint cp = new ConnectPoint(d.id(), p.number());
@@ -647,10 +663,8 @@
meterBands.add(createMeterBand(bpInfo.committedInformationRate(), bpInfo.committedBurstSize()));
meterBands.add(createMeterBand(bpInfo.exceededInformationRate(), bpInfo.exceededBurstSize()));
+ meterBands.add(createMeterBand(bpInfo.assuredInformationRate(), 0L));
- if (bpInfo.assuredInformationRate() != 0) {
- meterBands.add(createMeterBand(bpInfo.assuredInformationRate(), 0L));
- }
return meterBands;
}
@@ -684,9 +698,7 @@
downstreamTreatmentBuilder.meter(meterId);
}
- if (techProfId != -1) {
- downstreamTreatmentBuilder.transition(techProfId);
- }
+ downstreamTreatmentBuilder.writeMetadata(createMetadata(subscriberVlan, techProfId, subscriberPort), 0);
return DefaultForwardingObjective.builder()
.withFlag(ForwardingObjective.Flag.VERSATILE)
@@ -729,10 +741,7 @@
upstreamTreatmentBuilder.meter(meterId);
}
- if (technologyProfileId != -1) {
- upstreamTreatmentBuilder.transition(technologyProfileId);
-
- }
+ upstreamTreatmentBuilder.writeMetadata(createMetadata(deviceVlan, technologyProfileId, uplinkPort), 0L);
return DefaultForwardingObjective.builder()
.withFlag(ForwardingObjective.Flag.VERSATILE)
@@ -742,6 +751,7 @@
.fromApp(appId)
.withTreatment(upstreamTreatmentBuilder.build());
}
+
private void provisionTransparentFlows(DeviceId deviceId, PortNumber uplinkPort,
PortNumber subscriberPort,
VlanId innerVlan,
@@ -905,11 +915,22 @@
return;
}
DefaultFilteringObjective.Builder builder = DefaultFilteringObjective.builder();
+ TrafficTreatment.Builder treatmentBuilder = DefaultTrafficTreatment.builder();
+ BandwidthProfileInformation defaultBpInfo = getBandwidthProfileInformation(defaultBpId);
+ if (defaultBpInfo != null) {
+ MeterId meterId = createMeter(devId, defaultBpInfo);
+ treatmentBuilder.meter(meterId);
+ } else {
+ log.warn("Default bandwidth profile is not found. Authentication flow will be installed without meter");
+ }
+
+ //Authentication trap flow uses only tech profile id as metadata
FilteringObjective eapol = (install ? builder.permit() : builder.deny())
.withKey(Criteria.matchInPort(port))
.addCondition(Criteria.matchEthType(EthType.EtherType.EAPOL.ethType()))
- .withMeta(DefaultTrafficTreatment.builder()
+ .withMeta(treatmentBuilder
+ .writeMetadata((long) defaultTechProfileId << 32, 0)
.setOutput(PortNumber.CONTROLLER).build())
.fromApp(appId)
.withPriority(10000)
@@ -936,8 +957,8 @@
* Installs trap filtering objectives for particular traffic types on an
* NNI port.
*
- * @param devId device ID
- * @param port port number
+ * @param devId device ID
+ * @param port port number
* @param install true to install, false to remove
*/
private void processNniFilteringObjectives(DeviceId devId, PortNumber port, boolean install) {
@@ -982,11 +1003,11 @@
/**
* Trap dhcp packets to the controller.
*
- * @param devId the device identifier
- * @param port the port for which this trap flow is designated
- * @param install true to install the flow, false to remove the flow
+ * @param devId the device identifier
+ * @param port the port for which this trap flow is designated
+ * @param install true to install the flow, false to remove the flow
* @param upstream true if trapped packets are flowing upstream towards
- * server, false if packets are flowing dowstream towards client
+ * server, false if packets are flowing dowstream towards client
*/
private void processDhcpFilteringObjectives(DeviceId devId, PortNumber port,
boolean install,
@@ -1040,16 +1061,16 @@
@Override
public void onSuccess(Objective objective) {
log.info("DHCP {} filter for device {} on port {} {}.",
- (ethType.equals(EthType.EtherType.IPV4.ethType())) ? "v4" : "v6",
- devId, port, (install) ? "installed" : "removed");
+ (ethType.equals(EthType.EtherType.IPV4.ethType())) ? "v4" : "v6",
+ devId, port, (install) ? "installed" : "removed");
}
@Override
public void onError(Objective objective, ObjectiveError error) {
log.info("DHCP {} filter for device {} on port {} failed {} because {}",
- (ethType.equals(EthType.EtherType.IPV4.ethType())) ? "v4" : "v6",
- devId, port, (install) ? "installation" : "removal",
- error);
+ (ethType.equals(EthType.EtherType.IPV4.ethType())) ? "v4" : "v6",
+ devId, port, (install) ? "installation" : "removal",
+ error);
}
});
@@ -1121,7 +1142,7 @@
/**
* Get the uplink for of the OLT device.
- *
+ * <p>
* This assumes that the OLT has a single uplink port. When more uplink ports need to be supported
* this logic needs to be changed
*
@@ -1138,7 +1159,7 @@
return null;
}
// Return the port that has been configured as the uplink port of this OLT in Sadis
- for (Port p: deviceService.getPorts(dev.id())) {
+ for (Port p : deviceService.getPorts(dev.id())) {
if (p.number().toLong() == deviceInfo.uplinkPort()) {
log.debug("getUplinkPort: Found port {}", p);
return p;
@@ -1162,6 +1183,23 @@
return subsService.get(portName);
}
+ /**
+ * Write metadata instruction value (metadata) is 8 bytes.
+ *
+ * MS 2 bytes: C Tag
+ * Next 2 bytes: Technology Profile Id
+ * Next 4 bytes: Port number (uni or nni)
+ */
+
+ private Long createMetadata(VlanId innerVlan, int techProfileId, PortNumber egressPort) {
+
+ if (techProfileId == -1) {
+ techProfileId = DEFAULT_TP_ID;
+ }
+
+ return ((long) (innerVlan.id()) << 48 | (long) techProfileId << 32) | egressPort.toLong();
+ }
+
private boolean isUniPort(Device d, Port p) {
Port ulPort = getUplinkPort(d);
if (ulPort != null) {
diff --git a/app/src/main/resources/vlan_cfg_with_default.json b/app/src/main/resources/vlan_cfg_with_default.json
new file mode 100644
index 0000000..7cd792a
--- /dev/null
+++ b/app/src/main/resources/vlan_cfg_with_default.json
@@ -0,0 +1,70 @@
+{
+ "apps" : {
+ "org.opencord.sadis" : {
+ "sadis" : {
+ "integration" : {
+ "cache" : {
+ "enabled" : true,
+ "maxsize" : 60,
+ "ttl" : "PT1m"
+ }
+ },
+ "entries" : [ {
+ "id" : "s1-eth1",
+ "cTag" : 2,
+ "sTag" : 4,
+ "nasPortId" : "s1-eth1",
+ "technologyProfileId" : 10,
+ "upstreamBandwidthProfile" : "High-Speed-Internet",
+ "downstreamBandwidthProfile" : "User1-Specific"
+ }, {
+ "id" : "1",
+ "hardwareIdentifier" : "00:00:00:00:00:01",
+ "ipAddress" : "127.0.0.1",
+ "uplinkPort": "2"
+ } ]
+ },
+ "bandwidthprofile":{
+ "integration":{
+ "cache":{
+ "enabled":true,
+ "maxsize":40,
+ "ttl":"PT1m"
+ }
+ },
+ "entries":[
+ {
+ "id":"High-Speed-Internet",
+ "cir":200000000,
+ "cbs":348000,
+ "eir":10000000,
+ "ebs":348000,
+ "air":10000000
+ },
+ {
+ "id":"User1-Specific",
+ "cir":300000000,
+ "cbs":348000,
+ "eir":20000000,
+ "ebs":348000
+ },
+ {
+ "id":"Default",
+ "cir":0,
+ "cbs":0,
+ "eir":512,
+ "ebs":30,
+ "air":0
+ }
+ ]
+ }
+ }
+ },
+ "devices":{
+ "of:0000000000000001":{
+ "basic":{
+ "driver":"pmc-olt"
+ }
+ }
+ }
+}
diff --git a/pom.xml b/pom.xml
index b9d22a8..bcd8637 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,18 +22,18 @@
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos-dependencies</artifactId>
- <version>1.13.6</version>
+ <version>1.13.8</version>
<relativePath></relativePath>
</parent>
<groupId>org.opencord</groupId>
<artifactId>olt</artifactId>
- <version>3.0.0-SNAPSHOT</version>
+ <version>3.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <onos.version>1.13.6</onos.version>
+ <onos.version>1.13.8</onos.version>
</properties>
<modules>