[ONOS-6183] NET l3VPN structure and store implementation
Change-Id: I2fc9054dba07ef522b3cc879810422bd0f1f5de4
diff --git a/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/VpnInstance.java b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/VpnInstance.java
new file mode 100644
index 0000000..b411b87
--- /dev/null
+++ b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/VpnInstance.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2017-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.l3vpn.netl3vpn;
+
+import org.onosproject.net.DeviceId;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * Representation of stored VPN instance, which contains the configuration
+ * such as RD and RT, also the device info and the VPN type.
+ */
+public class VpnInstance<T extends VpnConfig> {
+
+ /**
+ * VPN instance name.
+ */
+ private String vpnName;
+
+ /**
+ * List of devices for the VPN.
+ */
+ private Map<DeviceId, DeviceInfo> devInfo;
+
+ /**
+ * Type of the VPN.
+ */
+ private VpnType type;
+
+ /**
+ * VPN config information.
+ */
+ private T vpnConfig;
+
+ /**
+ * Creates VPN instance with VPN name.
+ *
+ * @param v VPN name
+ */
+ public VpnInstance(String v) {
+ vpnName = v;
+ }
+
+ /**
+ * Returns the type of the VPN instance.
+ *
+ * @return VPN type
+ */
+ VpnType type() {
+ return type;
+ }
+
+ /**
+ * Sets the type of the VPN instance.
+ *
+ * @param type VPN type
+ */
+ void type(VpnType type) {
+ this.type = type;
+ }
+
+ /**
+ * Returns the configuration of VPN instance.
+ *
+ * @return VPN config
+ */
+ T vpnConfig() {
+ return vpnConfig;
+ }
+
+ /**
+ * Sets the configuration of VPN instance.
+ *
+ * @param vpnConfig VPN config
+ */
+ void vpnConfig(T vpnConfig) {
+ this.vpnConfig = vpnConfig;
+ }
+
+ /**
+ * Returns the device info map.
+ *
+ * @return device info map
+ */
+ Map<DeviceId, DeviceInfo> devInfo() {
+ return devInfo;
+ }
+
+ /**
+ * Sets the device info map.
+ *
+ * @param devInfo device info map
+ */
+ void devInfo(Map<DeviceId, DeviceInfo> devInfo) {
+ this.devInfo = devInfo;
+ }
+
+ /**
+ * Adds the content to device info map.
+ *
+ * @param id device id
+ * @param info device info
+ */
+ void devInfo(DeviceId id, DeviceInfo info) {
+ if (devInfo == null) {
+ devInfo = new LinkedHashMap<>();
+ }
+ devInfo.put(id, info);
+ }
+
+ /**
+ * Returns the VPN instance name.
+ *
+ * @return VPN name
+ */
+ String vpnName() {
+ return vpnName;
+ }
+}