From 5b2eaca070f4282ad32f620aaf479395fb6654de Mon Sep 17 00:00:00 2001 From: Ashlee Young Date: Sat, 14 Nov 2015 09:53:10 -0800 Subject: ONOS commit 4832784ed4032361f4c776b79a1de9c013c41226 Change-Id: I710a23a1485c08f006d3ead26f5281c2d1a986e4 Signed-off-by: Ashlee Young --- build.sh | 17 ++++++++--------- .../java/org/onosproject/olt/AccessDeviceConfig.java | 14 +++++++++++++- .../java/org/onosproject/olt/AccessDeviceData.java | 18 ++++++++++++++++-- .../olt/src/main/java/org/onosproject/olt/OLT.java | 11 +++++++---- 4 files changed, 44 insertions(+), 16 deletions(-) diff --git a/build.sh b/build.sh index 5929fcb1..d0acb594 100755 --- a/build.sh +++ b/build.sh @@ -18,9 +18,9 @@ # limitations under the License. ##### Settings ##### -VERSION=1.0.3 +VERSION=1.0.4 AUTHOR="Ashlee Young" -MODIFIED="November 7, 2015" +MODIFIED="November 14, 2015" GERRITURL="git clone ssh://im2bz2pee@gerrit.opnfv.org:29418/onosfw" ONOSURL="https://github.com/opennetworkinglab/onos" SURICATAURL="https://github.com/inliniac/suricata" @@ -49,7 +49,7 @@ detectOS() else OS=other fi - echo $OS + printf "We have detected a derivitive OS of $OS.\n\n" } ##### End Platform detection ##### @@ -106,8 +106,10 @@ ask() ##### Version ##### displayVersion() { + clear printf "You are running installer script Version: %s \n" "$VERSION" printf "Last modified on %s, by %s. \n\n" "$MODIFIED" "$AUTHOR" + sleep 2 } ##### End Version ##### @@ -116,10 +118,9 @@ displayVersion() # repository in this project with just the diffs. updateONOS() { - clear - printf "This is mostly an admin function for the PTL, but you can use it to update your \n" - printf "local copy. If you need the main repo updated to pick up ONOS upstream features, please email \n" - printf "Ashlee at ashlee@onosfw.com. \n\n" + printf "NOTE: Updating upstream src is a PTL function. Please use this function locally, only. \n" + printf "If you need the main repo updated to pick up ONOS upstream features, please email \n" + printf "me at ashlee AT onosfw.com. \n\n" printf "Thanks! \n\n" if ask "Do you still wish to update your local ONOS source tree?"; then freshONOS @@ -300,8 +301,6 @@ buildONOS() cd $ONOSROOT mvn clean install fi - - fi } ##### End Build ONOS ##### diff --git a/framework/src/onos/apps/olt/src/main/java/org/onosproject/olt/AccessDeviceConfig.java b/framework/src/onos/apps/olt/src/main/java/org/onosproject/olt/AccessDeviceConfig.java index 90ed7403..07b73c84 100644 --- a/framework/src/onos/apps/olt/src/main/java/org/onosproject/olt/AccessDeviceConfig.java +++ b/framework/src/onos/apps/olt/src/main/java/org/onosproject/olt/AccessDeviceConfig.java @@ -16,11 +16,14 @@ package org.onosproject.olt; +import com.fasterxml.jackson.databind.JsonNode; import org.onlab.packet.VlanId; import org.onosproject.net.DeviceId; import org.onosproject.net.PortNumber; import org.onosproject.net.config.Config; +import java.util.Optional; + /** * Config object for access device data. */ @@ -28,6 +31,7 @@ public class AccessDeviceConfig extends Config { private static final String UPLINK = "uplink"; private static final String VLAN = "vlan"; + private static final String DEFAULT_VLAN = "defaultVlan"; /** * Gets the access device configuration for this device. @@ -37,7 +41,15 @@ public class AccessDeviceConfig extends Config { public AccessDeviceData getOlt() { PortNumber uplink = PortNumber.portNumber(node.path(UPLINK).asText()); VlanId vlan = VlanId.vlanId(Short.parseShort(node.path(VLAN).asText())); + JsonNode defaultVlanNode = node.path(DEFAULT_VLAN); + + Optional defaultVlan; + if (defaultVlanNode.isMissingNode()) { + defaultVlan = Optional.empty(); + } else { + defaultVlan = Optional.of(VlanId.vlanId(Short.parseShort(defaultVlanNode.asText()))); + } - return new AccessDeviceData(subject(), uplink, vlan); + return new AccessDeviceData(subject(), uplink, vlan, defaultVlan); } } diff --git a/framework/src/onos/apps/olt/src/main/java/org/onosproject/olt/AccessDeviceData.java b/framework/src/onos/apps/olt/src/main/java/org/onosproject/olt/AccessDeviceData.java index f7e40e30..18b5e99f 100644 --- a/framework/src/onos/apps/olt/src/main/java/org/onosproject/olt/AccessDeviceData.java +++ b/framework/src/onos/apps/olt/src/main/java/org/onosproject/olt/AccessDeviceData.java @@ -20,6 +20,8 @@ import org.onlab.packet.VlanId; import org.onosproject.net.DeviceId; import org.onosproject.net.PortNumber; +import java.util.Optional; + import static com.google.common.base.Preconditions.checkNotNull; /** @@ -33,6 +35,7 @@ public class AccessDeviceData { private final DeviceId deviceId; private final PortNumber uplink; private final VlanId vlan; + private final Optional defaultVlan; /** * Class constructor. @@ -41,10 +44,12 @@ public class AccessDeviceData { * @param uplink uplink port number * @param vlan device VLAN ID */ - public AccessDeviceData(DeviceId deviceId, PortNumber uplink, VlanId vlan) { + public AccessDeviceData(DeviceId deviceId, PortNumber uplink, VlanId vlan, + Optional defaultVlan) { this.deviceId = checkNotNull(deviceId, DEVICE_ID_MISSING); this.uplink = checkNotNull(uplink, UPLINK_MISSING); this.vlan = checkNotNull(vlan, VLAN_MISSING); + this.defaultVlan = checkNotNull(defaultVlan); } /** @@ -68,9 +73,18 @@ public class AccessDeviceData { /** * Retrieves the VLAN ID assigned to the device. * - * @return vlan ID + * @return VLAN ID */ public VlanId vlan() { return vlan; } + + /** + * Retrieves the default VLAN ID that will be used for this device. + * + * @return default VLAN ID + */ + public Optional defaultVlan() { + return defaultVlan; + } } diff --git a/framework/src/onos/apps/olt/src/main/java/org/onosproject/olt/OLT.java b/framework/src/onos/apps/olt/src/main/java/org/onosproject/olt/OLT.java index 9aa8865a..d5d7d277 100644 --- a/framework/src/onos/apps/olt/src/main/java/org/onosproject/olt/OLT.java +++ b/framework/src/onos/apps/olt/src/main/java/org/onosproject/olt/OLT.java @@ -52,6 +52,7 @@ import org.slf4j.Logger; import java.util.Dictionary; import java.util.Map; +import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; import static org.slf4j.LoggerFactory.getLogger; @@ -247,15 +248,17 @@ public class OLT implements AccessDeviceService { return; } - provisionVlans(olt.deviceId(), olt.uplink(), port.port(), vlan, olt.vlan()); + provisionVlans(olt.deviceId(), olt.uplink(), port.port(), vlan, olt.vlan(), + olt.defaultVlan()); } private void provisionVlans(DeviceId deviceId, PortNumber uplinkPort, PortNumber subscriberPort, - VlanId subscriberVlan, VlanId deviceVlan) { + VlanId subscriberVlan, VlanId deviceVlan, + Optional defaultVlan) { TrafficSelector upstream = DefaultTrafficSelector.builder() - .matchVlanId(DEFAULT_VLAN) + .matchVlanId((defaultVlan.isPresent()) ? defaultVlan.get() : DEFAULT_VLAN) .matchInPort(subscriberPort) .build(); @@ -273,7 +276,7 @@ public class OLT implements AccessDeviceService { TrafficTreatment downstreamTreatment = DefaultTrafficTreatment.builder() .popVlan() - .setVlanId(DEFAULT_VLAN) + .setVlanId((defaultVlan.isPresent()) ? defaultVlan.get() : DEFAULT_VLAN) .setOutput(subscriberPort) .build(); -- cgit 1.2.3-korg