Refactored to handle service instance by service type
- Added service instance handler
- Implemented dummy, vsg, and olt agent instance handler
Change-Id: Id3edd5eecb1caadf0f835cb10a952100e18b283b
diff --git a/src/main/java/org/onosproject/cordvtn/impl/service/DummyInstanceHandler.java b/src/main/java/org/onosproject/cordvtn/impl/service/DummyInstanceHandler.java
new file mode 100644
index 0000000..ee78218
--- /dev/null
+++ b/src/main/java/org/onosproject/cordvtn/impl/service/DummyInstanceHandler.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.cordvtn.impl.service;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+
+import org.apache.felix.scr.annotations.Deactivate;
+import org.onosproject.cordvtn.api.Instance;
+import org.onosproject.cordvtn.api.InstanceHandler;
+import org.onosproject.cordvtn.impl.CordVtnInstanceHandler;
+import org.onosproject.xosclient.api.VtnService;
+
+import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor;
+import static org.onlab.util.Tools.groupedThreads;
+
+/**
+ * Provides network connectivity for dummy service instances.
+ */
+@Component(immediate = true)
+public class DummyInstanceHandler extends CordVtnInstanceHandler implements InstanceHandler {
+
+ @Activate
+ protected void activate() {
+ serviceType = VtnService.ServiceType.DUMMY;
+ eventExecutor = newSingleThreadScheduledExecutor(groupedThreads("onos/cordvtn-dummy", "event-handler"));
+ super.activate();
+ }
+
+ @Deactivate
+ protected void deactivate() {
+ super.deactivate();
+ }
+
+ @Override
+ public void instanceDetected(Instance instance) {
+ super.instanceDetected(instance);
+ }
+
+ @Override
+ public void instanceRemoved(Instance instance) {
+ super.instanceRemoved(instance);
+ }
+}
diff --git a/src/main/java/org/onosproject/cordvtn/impl/service/OltAgentInstanceHandler.java b/src/main/java/org/onosproject/cordvtn/impl/service/OltAgentInstanceHandler.java
new file mode 100644
index 0000000..eaec689
--- /dev/null
+++ b/src/main/java/org/onosproject/cordvtn/impl/service/OltAgentInstanceHandler.java
@@ -0,0 +1,176 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.cordvtn.impl.service;
+
+import com.google.common.collect.Maps;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.onlab.packet.Ethernet;
+import org.onlab.packet.IpPrefix;
+import org.onosproject.cordconfig.access.AccessAgentConfig;
+import org.onosproject.cordconfig.access.AccessAgentData;
+import org.onosproject.cordvtn.api.CordVtnConfig;
+import org.onosproject.cordvtn.api.Instance;
+import org.onosproject.cordvtn.api.InstanceHandler;
+import org.onosproject.cordvtn.impl.CordVtnInstanceHandler;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.config.ConfigFactory;
+import org.onosproject.net.config.NetworkConfigEvent;
+import org.onosproject.net.config.NetworkConfigListener;
+import org.onosproject.net.config.basics.SubjectFactories;
+import org.onosproject.net.flow.DefaultFlowRule;
+import org.onosproject.net.flow.DefaultTrafficSelector;
+import org.onosproject.net.flow.DefaultTrafficTreatment;
+import org.onosproject.net.flow.FlowRule;
+import org.onosproject.net.flow.TrafficSelector;
+import org.onosproject.net.flow.TrafficTreatment;
+import org.onosproject.xosclient.api.VtnService;
+
+import java.util.Map;
+import java.util.Set;
+
+import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor;
+import static org.onlab.util.Tools.groupedThreads;
+import static org.onosproject.cordvtn.impl.CordVtnPipeline.PRIORITY_MANAGEMENT;
+import static org.onosproject.cordvtn.impl.CordVtnPipeline.TABLE_ACCESS_TYPE;
+
+/**
+ * Provides network connectivity for OLT agent instances.
+ */
+@Component(immediate = true)
+public class OltAgentInstanceHandler extends CordVtnInstanceHandler implements InstanceHandler {
+
+ private static final Class<AccessAgentConfig> CONFIG_CLASS = AccessAgentConfig.class;
+ private ConfigFactory<DeviceId, AccessAgentConfig> configFactory =
+ new ConfigFactory<DeviceId, AccessAgentConfig>(
+ SubjectFactories.DEVICE_SUBJECT_FACTORY, CONFIG_CLASS, "accessAgent") {
+ @Override
+ public AccessAgentConfig createConfig() {
+ return new AccessAgentConfig();
+ }
+ };
+
+ private Map<DeviceId, AccessAgentData> oltAgentData = Maps.newConcurrentMap();
+ private IpPrefix mgmtIpRange = null;
+
+ @Activate
+ protected void activate() {
+ eventExecutor = newSingleThreadScheduledExecutor(groupedThreads("onos/cordvtn-olt", "event-handler"));
+ serviceType = VtnService.ServiceType.OLT_AGENT;
+
+ configRegistry.registerConfigFactory(configFactory);
+ configListener = new InternalConfigListener();
+
+ super.activate();
+ }
+
+ @Deactivate
+ protected void deactivate() {
+ super.deactivate();
+ }
+
+ @Override
+ public void instanceDetected(Instance instance) {
+ log.info("OLT agent instance detected {}", instance);
+
+ managementAccessRule(instance.deviceId(), true);
+ // TODO implement
+ }
+
+ @Override
+ public void instanceRemoved(Instance instance) {
+ log.info("OLT agent instance removed {}", instance);
+
+ if (getInstances(instance.serviceId()).isEmpty()) {
+ nodeManager.completeNodes().stream().forEach(node ->
+ managementAccessRule(node.intBrId(), false));
+ }
+
+ // TODO implement
+ }
+
+ private void managementAccessRule(DeviceId deviceId, boolean install) {
+ // TODO remove this rule after long term management network is done
+ if (mgmtIpRange != null) {
+ TrafficSelector selector = DefaultTrafficSelector.builder()
+ .matchEthType(Ethernet.TYPE_IPV4)
+ .matchIPDst(mgmtIpRange)
+ .build();
+
+ TrafficTreatment treatment = DefaultTrafficTreatment.builder()
+ .setOutput(PortNumber.LOCAL)
+ .build();
+
+ FlowRule flowRule = DefaultFlowRule.builder()
+ .fromApp(appId)
+ .withSelector(selector)
+ .withTreatment(treatment)
+ .withPriority(PRIORITY_MANAGEMENT)
+ .forDevice(deviceId)
+ .forTable(TABLE_ACCESS_TYPE)
+ .makePermanent()
+ .build();
+
+ pipeline.processFlowRule(install, flowRule);
+ }
+ }
+
+ private void readAccessAgentConfig() {
+
+ Set<DeviceId> deviceSubjects = configRegistry.getSubjects(DeviceId.class, CONFIG_CLASS);
+ deviceSubjects.stream().forEach(subject -> {
+ AccessAgentConfig config = configRegistry.getConfig(subject, CONFIG_CLASS);
+ if (config != null) {
+ oltAgentData.put(subject, config.getAgent());
+ }
+ });
+ }
+
+ @Override
+ protected void readConfiguration() {
+ CordVtnConfig config = configRegistry.getConfig(appId, CordVtnConfig.class);
+ if (config == null) {
+ log.debug("No configuration found");
+ return;
+ }
+
+ osAccess = config.openstackAccess();
+ xosAccess = config.xosAccess();
+ mgmtIpRange = config.managementIpRange();
+ }
+
+ public class InternalConfigListener implements NetworkConfigListener {
+
+ @Override
+ public void event(NetworkConfigEvent event) {
+
+ switch (event.type()) {
+ case CONFIG_UPDATED:
+ case CONFIG_ADDED:
+ if (event.configClass().equals(CordVtnConfig.class)) {
+ readConfiguration();
+ } else if (event.configClass().equals(CONFIG_CLASS)) {
+ readAccessAgentConfig();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+}
diff --git a/src/main/java/org/onosproject/cordvtn/impl/service/VsgInstanceHandler.java b/src/main/java/org/onosproject/cordvtn/impl/service/VsgInstanceHandler.java
new file mode 100644
index 0000000..f60f72b
--- /dev/null
+++ b/src/main/java/org/onosproject/cordvtn/impl/service/VsgInstanceHandler.java
@@ -0,0 +1,379 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.cordvtn.impl.service;
+
+import com.google.common.base.Strings;
+import com.google.common.collect.Sets;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.Service;
+import org.onlab.packet.Ethernet;
+import org.onlab.packet.IpAddress;
+import org.onlab.packet.IpPrefix;
+import org.onlab.packet.MacAddress;
+import org.onlab.packet.VlanId;
+import org.onosproject.cordvtn.api.Instance;
+import org.onosproject.cordvtn.api.InstanceHandler;
+import org.onosproject.cordvtn.impl.CordVtnInstanceHandler;
+import org.onosproject.cordvtn.impl.CordVtnInstanceManager;
+import org.onosproject.net.DefaultAnnotations;
+import org.onosproject.net.HostId;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.flow.DefaultFlowRule;
+import org.onosproject.net.flow.DefaultTrafficSelector;
+import org.onosproject.net.flow.DefaultTrafficTreatment;
+import org.onosproject.net.flow.FlowRule;
+import org.onosproject.net.flow.FlowRuleService;
+import org.onosproject.net.flow.TrafficSelector;
+import org.onosproject.net.flow.TrafficTreatment;
+import org.onosproject.net.flow.criteria.Criterion;
+import org.onosproject.net.flow.criteria.IPCriterion;
+import org.onosproject.net.flow.instructions.Instruction;
+import org.onosproject.net.flow.instructions.Instructions;
+import org.onosproject.net.flow.instructions.L2ModificationInstruction;
+import org.onosproject.net.host.DefaultHostDescription;
+import org.onosproject.net.host.HostDescription;
+import org.onosproject.xosclient.api.VtnPort;
+import org.onosproject.xosclient.api.VtnPortApi;
+import org.onosproject.xosclient.api.VtnPortId;
+import org.onosproject.xosclient.api.VtnService;
+
+import java.util.Map;
+import java.util.Set;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor;
+import static org.onlab.util.Tools.groupedThreads;
+import static org.onosproject.cordvtn.api.Instance.*;
+import static org.onosproject.cordvtn.impl.CordVtnPipeline.*;
+import static org.onosproject.net.flow.criteria.Criterion.Type.IPV4_DST;
+import static org.onosproject.net.flow.instructions.L2ModificationInstruction.L2SubType.VLAN_PUSH;
+
+/**
+ * Provides network connectivity for vSG instances.
+ */
+@Component(immediate = true)
+@Service(value = VsgInstanceHandler.class)
+public final class VsgInstanceHandler extends CordVtnInstanceHandler implements InstanceHandler {
+
+ private static final String STAG = "stag";
+ private static final String VSG_VM = "vsgVm";
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected FlowRuleService flowRuleService;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected CordVtnInstanceManager instanceManager;
+
+ @Activate
+ protected void activate() {
+ serviceType = VtnService.ServiceType.VSG;
+ eventExecutor = newSingleThreadScheduledExecutor(groupedThreads("onos/cordvtn-vsg", "event-handler"));
+ super.activate();
+ }
+
+ @Deactivate
+ protected void deactivate() {
+ super.deactivate();
+ }
+
+ @Override
+ public void instanceDetected(Instance instance) {
+ if (isVsgContainer(instance)) {
+ log.info("vSG container detected {}", instance);
+
+ // find vsg vm for this vsg container
+ String vsgVmId = instance.getAnnotation(VSG_VM);
+ if (Strings.isNullOrEmpty(vsgVmId)) {
+ log.warn("Failed to find VSG VM for {}", instance);
+ return;
+ }
+
+ Instance vsgVm = Instance.of(hostService.getHost(HostId.hostId(vsgVmId)));
+ VtnPort vtnPort = getVtnPort(vsgVm);
+ if (vtnPort == null || getStag(vtnPort) == null) {
+ return;
+ }
+
+ populateVsgRules(vsgVm, getStag(vtnPort),
+ nodeManager.dpPort(vsgVm.deviceId()),
+ vtnPort.addressPairs().keySet(),
+ true);
+
+ } else {
+ VtnPort vtnPort = getVtnPort(instance);
+ if (vtnPort == null || getStag(vtnPort) == null) {
+ return;
+ }
+
+ vtnPort.addressPairs().entrySet().stream()
+ .forEach(pair -> addVsgContainer(
+ instance,
+ pair.getKey(),
+ pair.getValue(),
+ getStag(vtnPort).toString()
+ ));
+ super.instanceDetected(instance);
+ }
+ }
+
+ @Override
+ public void instanceRemoved(Instance instance) {
+ if (isVsgContainer(instance)) {
+ log.info("vSG container vanished {}", instance);
+
+ // find vsg vm for this vsg container
+ String vsgVmId = instance.getAnnotation(VSG_VM);
+ if (Strings.isNullOrEmpty(vsgVmId)) {
+ log.warn("Failed to find VSG VM for {}", instance);
+ return;
+ }
+
+ Instance vsgVm = Instance.of(hostService.getHost(HostId.hostId(vsgVmId)));
+ VtnPort vtnPort = getVtnPort(vsgVm);
+ if (vtnPort == null || getStag(vtnPort) == null) {
+ return;
+ }
+
+ populateVsgRules(vsgVm, getStag(vtnPort),
+ nodeManager.dpPort(vsgVm.deviceId()),
+ vtnPort.addressPairs().keySet(),
+ false);
+
+ } else {
+ // TODO remove vsg vm related rules
+ super.instanceRemoved(instance);
+ }
+ }
+
+ /**
+ * Updates set of vSGs in a given vSG VM.
+ *
+ * @param vsgVmId vsg vm host id
+ * @param stag stag
+ * @param vsgInstances full set of vsg wan ip and mac address pairs in this vsg vm
+ */
+ public void updateVsgInstances(HostId vsgVmId, String stag, Map<IpAddress, MacAddress> vsgInstances) {
+ if (hostService.getHost(vsgVmId) == null) {
+ log.debug("vSG VM {} is not added yet, ignore this update", vsgVmId);
+ return;
+ }
+
+ Instance vsgVm = Instance.of(hostService.getHost(vsgVmId));
+ if (vsgVm == null) {
+ log.warn("Failed to find existing vSG VM for STAG: {}", stag);
+ return;
+ }
+
+ log.info("Updates vSGs in {} with STAG: {}", vsgVm, stag);
+
+ // adds vSGs in the address pair
+ vsgInstances.entrySet().stream()
+ .filter(addr -> hostService.getHostsByMac(addr.getValue()).isEmpty())
+ .forEach(addr -> addVsgContainer(
+ vsgVm,
+ addr.getKey(),
+ addr.getValue(),
+ stag));
+
+ // removes vSGs not listed in the address pair
+ hostService.getConnectedHosts(vsgVm.host().location()).stream()
+ .filter(host -> !host.mac().equals(vsgVm.mac()))
+ .filter(host -> !vsgInstances.values().contains(host.mac()))
+ .forEach(host -> {
+ log.info("Removed vSG {}", host.toString());
+ instanceManager.removeInstance(host.id());
+ });
+ }
+
+ private boolean isVsgContainer(Instance instance) {
+ return !Strings.isNullOrEmpty(instance.host().annotations().value(STAG));
+ }
+
+ private void addVsgContainer(Instance vsgVm, IpAddress vsgWanIp, MacAddress vsgMac,
+ String stag) {
+ HostId hostId = HostId.hostId(vsgMac);
+ DefaultAnnotations.Builder annotations = DefaultAnnotations.builder()
+ .set(SERVICE_TYPE, vsgVm.serviceType().toString())
+ .set(SERVICE_ID, vsgVm.serviceId().id())
+ .set(PORT_ID, vsgVm.portId().id())
+ .set(NESTED_INSTANCE, TRUE)
+ .set(STAG, stag)
+ .set(VSG_VM, vsgVm.host().id().toString())
+ .set(CREATE_TIME, String.valueOf(System.currentTimeMillis()));
+
+ HostDescription hostDesc = new DefaultHostDescription(
+ vsgMac,
+ VlanId.NONE,
+ vsgVm.host().location(),
+ Sets.newHashSet(vsgWanIp),
+ annotations.build());
+
+ instanceManager.addInstance(hostId, hostDesc);
+ }
+
+ private void populateVsgRules(Instance vsgVm, VlanId stag, PortNumber dpPort,
+ Set<IpAddress> vsgWanIps, boolean install) {
+ // for traffics with s-tag, strip the tag and take through the vSG VM
+ TrafficSelector selector = DefaultTrafficSelector.builder()
+ .matchInPort(dpPort)
+ .matchVlanId(stag)
+ .build();
+
+ TrafficTreatment treatment = DefaultTrafficTreatment.builder()
+ .setOutput(vsgVm.portNumber())
+ .build();
+
+ FlowRule flowRule = DefaultFlowRule.builder()
+ .fromApp(appId)
+ .withSelector(selector)
+ .withTreatment(treatment)
+ .withPriority(PRIORITY_DEFAULT)
+ .forDevice(vsgVm.deviceId())
+ .forTable(TABLE_VLAN)
+ .makePermanent()
+ .build();
+
+ pipeline.processFlowRule(install, flowRule);
+
+ // for traffics with customer vlan, tag with the service vlan based on input port with
+ // lower priority to avoid conflict with WAN tag
+ selector = DefaultTrafficSelector.builder()
+ .matchInPort(vsgVm.portNumber())
+ .matchVlanId(stag)
+ .build();
+
+ treatment = DefaultTrafficTreatment.builder()
+ .setOutput(dpPort)
+ .build();
+
+ flowRule = DefaultFlowRule.builder()
+ .fromApp(appId)
+ .withSelector(selector)
+ .withTreatment(treatment)
+ .withPriority(PRIORITY_DEFAULT)
+ .forDevice(vsgVm.deviceId())
+ .forTable(TABLE_VLAN)
+ .makePermanent()
+ .build();
+
+ pipeline.processFlowRule(install, flowRule);
+
+ // for traffic coming from WAN, tag 500 and take through the vSG VM
+ // based on destination ip
+ vsgWanIps.stream().forEach(ip -> {
+ TrafficSelector downstream = DefaultTrafficSelector.builder()
+ .matchEthType(Ethernet.TYPE_IPV4)
+ .matchIPDst(ip.toIpPrefix())
+ .build();
+
+ TrafficTreatment downstreamTreatment = DefaultTrafficTreatment.builder()
+ .pushVlan()
+ .setVlanId(VLAN_WAN)
+ .setEthDst(vsgVm.mac())
+ .setOutput(vsgVm.portNumber())
+ .build();
+
+ FlowRule downstreamFlowRule = DefaultFlowRule.builder()
+ .fromApp(appId)
+ .withSelector(downstream)
+ .withTreatment(downstreamTreatment)
+ .withPriority(PRIORITY_DEFAULT)
+ .forDevice(vsgVm.deviceId())
+ .forTable(TABLE_DST_IP)
+ .makePermanent()
+ .build();
+
+ pipeline.processFlowRule(install, downstreamFlowRule);
+ });
+
+ // remove downstream flow rules for the vSG not shown in vsgWanIps
+ for (FlowRule rule : flowRuleService.getFlowRulesById(appId)) {
+ if (!rule.deviceId().equals(vsgVm.deviceId())) {
+ continue;
+ }
+ PortNumber output = getOutputFromTreatment(rule);
+ if (output == null || !output.equals(vsgVm.portNumber()) ||
+ !isVlanPushFromTreatment(rule)) {
+ continue;
+ }
+
+ IpPrefix dstIp = getDstIpFromSelector(rule);
+ if (dstIp != null && !vsgWanIps.contains(dstIp.address())) {
+ pipeline.processFlowRule(false, rule);
+ }
+ }
+ }
+
+ private VtnPort getVtnPort(Instance instance) {
+ checkNotNull(osAccess, OPENSTACK_ACCESS_ERROR);
+ checkNotNull(xosAccess, XOS_ACCESS_ERROR);
+
+ VtnPortId vtnPortId = instance.portId();
+ VtnPortApi portApi = xosClient.getClient(xosAccess).vtnPort();
+ VtnPort vtnPort = portApi.vtnPort(vtnPortId, osAccess);
+ if (vtnPort == null) {
+ log.warn("Failed to get port information of {}", instance);
+ return null;
+ }
+ return vtnPort;
+ }
+
+ // TODO get stag from XOS when XOS provides it, extract if from port name for now
+ private VlanId getStag(VtnPort vtnPort) {
+ checkNotNull(vtnPort);
+
+ String portName = vtnPort.name();
+ if (portName != null && portName.startsWith(STAG)) {
+ return VlanId.vlanId(portName.split("-")[1]);
+ } else {
+ return null;
+ }
+ }
+
+ private PortNumber getOutputFromTreatment(FlowRule flowRule) {
+ Instruction instruction = flowRule.treatment().allInstructions().stream()
+ .filter(inst -> inst instanceof Instructions.OutputInstruction)
+ .findFirst()
+ .orElse(null);
+ if (instruction == null) {
+ return null;
+ }
+ return ((Instructions.OutputInstruction) instruction).port();
+ }
+
+ private IpPrefix getDstIpFromSelector(FlowRule flowRule) {
+ Criterion criterion = flowRule.selector().getCriterion(IPV4_DST);
+ if (criterion != null && criterion instanceof IPCriterion) {
+ IPCriterion ip = (IPCriterion) criterion;
+ return ip.ip();
+ } else {
+ return null;
+ }
+ }
+
+ private boolean isVlanPushFromTreatment(FlowRule flowRule) {
+ Instruction instruction = flowRule.treatment().allInstructions().stream()
+ .filter(inst -> inst instanceof L2ModificationInstruction)
+ .filter(inst -> ((L2ModificationInstruction) inst).subtype().equals(VLAN_PUSH))
+ .findAny()
+ .orElse(null);
+ return instruction != null;
+ }
+}
diff --git a/src/main/java/org/onosproject/cordvtn/impl/service/package-info.java b/src/main/java/org/onosproject/cordvtn/impl/service/package-info.java
new file mode 100644
index 0000000..035b012
--- /dev/null
+++ b/src/main/java/org/onosproject/cordvtn/impl/service/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Implementation of instance handlers for various network services.
+ */
+package org.onosproject.cordvtn.impl.service;
\ No newline at end of file