[ONOS-6199] Huawei driver create and instance delete.
Change-Id: I61e1a8518e9bd2a1a5ed9430052a3e6d3233f148
diff --git a/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/DeviceInfo.java b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/DeviceInfo.java
index 4198ee8..648d556 100644
--- a/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/DeviceInfo.java
+++ b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/DeviceInfo.java
@@ -17,6 +17,8 @@
package org.onosproject.l3vpn.netl3vpn;
import org.onosproject.net.DeviceId;
+import org.onosproject.net.behaviour.L3vpnConfig;
+import org.onosproject.net.driver.DriverHandler;
import org.onosproject.net.driver.DriverService;
import org.onosproject.yang.model.ModelObjectData;
@@ -156,8 +158,8 @@
*/
public ModelObjectData processCreateInstance(DriverService driverSvc,
ModelObjectData modelData) {
- // TODO: Need to call the behaviour.
- return null;
+ L3vpnConfig config = getL3VpnConfig(driverSvc);
+ return (ModelObjectData) config.createInstance(modelData);
}
/**
@@ -171,8 +173,8 @@
*/
public ModelObjectData processCreateInterface(DriverService driverSvc,
ModelObjectData modData) {
- // TODO: Need to call the behaviour.
- return null;
+ L3vpnConfig config = getL3VpnConfig(driverSvc);
+ return (ModelObjectData) config.bindInterface(modData);
}
/**
@@ -188,8 +190,8 @@
public ModelObjectData processCreateBgpInfo(DriverService driverSvc,
BgpInfo bgpInfo,
BgpDriverInfo driverInfo) {
- // TODO: Need to call the behaviour.
- return null;
+ L3vpnConfig config = getL3VpnConfig(driverSvc);
+ return (ModelObjectData) config.createBgpInfo(bgpInfo, driverInfo);
}
/**
@@ -202,9 +204,9 @@
* @return driver instance model object data
*/
public ModelObjectData processDeleteInstance(DriverService driverSvc,
- ModelObjectData modData) {
- // TODO: Need to call the behaviour.
- return null;
+ ModelObjectData modData) {
+ L3vpnConfig config = getL3VpnConfig(driverSvc);
+ return (ModelObjectData) config.deleteInstance(modData);
}
/**
@@ -217,7 +219,7 @@
* @return driver interface model object data
*/
public ModelObjectData processDeleteInterface(DriverService driverSvc,
- ModelObjectData objectData) {
+ ModelObjectData objectData) {
// TODO: Need to call the behaviour.
return null;
}
@@ -233,9 +235,20 @@
* @return driver BGP model object data
*/
public ModelObjectData processDeleteBgpInfo(DriverService driverSvc,
- BgpInfo bgpInfo,
- BgpDriverInfo driverInfo) {
+ BgpInfo bgpInfo,
+ BgpDriverInfo driverInfo) {
// TODO: Need to call the behaviour.
return null;
}
+
+ /**
+ * Returns the L3VPN config instance from the behaviour.
+ *
+ * @param driverSvc driver service
+ * @return L3VPN config
+ */
+ private L3vpnConfig getL3VpnConfig(DriverService driverSvc) {
+ DriverHandler handler = driverSvc.createHandler(deviceId);
+ return handler.behaviour(L3vpnConfig.class);
+ }
}