added P4 script and Device Id handling
diff --git a/apps/fpcagent/src/main/java/org/onosproject/fpcagent/FpcRpcManager.java b/apps/fpcagent/src/main/java/org/onosproject/fpcagent/FpcRpcManager.java
index 13062d9..cdc6b32 100644
--- a/apps/fpcagent/src/main/java/org/onosproject/fpcagent/FpcRpcManager.java
+++ b/apps/fpcagent/src/main/java/org/onosproject/fpcagent/FpcRpcManager.java
@@ -31,6 +31,7 @@
import org.onosproject.fpcagent.providers.CpProviderService;
import org.onosproject.fpcagent.util.CacheManager;
import org.onosproject.fpcagent.util.FpcUtil;
+import org.onosproject.net.DeviceId;
import org.onosproject.net.device.DeviceEvent;
import org.onosproject.net.device.DeviceListener;
import org.onosproject.net.device.DeviceService;
@@ -226,6 +227,7 @@
dpnCommunicationService = DpnNgicCommunicator.getInstance();
} else if (controlProtocol.isAssignableFrom(P4DpnControlProtocol.class)) {
dpnCommunicationService = DpnP4Communicator.getInstance();
+ DpnP4Communicator.getInstance().setDeviceId(DeviceId.deviceId(optionalDpn.get().dpnId().toString()));
} else {
throw new RuntimeException("Control Protocol is not supported.");
}
@@ -390,6 +392,7 @@
dpnCommunicationService = DpnNgicCommunicator.getInstance();
} else if (controlProtocol.isAssignableFrom(P4DpnControlProtocol.class)) {
dpnCommunicationService = DpnP4Communicator.getInstance();
+ DpnP4Communicator.getInstance().setDeviceId(DeviceId.deviceId(optionalDpn.get().dpnId().toString()));
} else {
throw new RuntimeException("Control Protocol is not supported.");
}
@@ -544,6 +547,7 @@
dpnCommunicationService = DpnNgicCommunicator.getInstance();
} else if (controlProtocol.isAssignableFrom(P4DpnControlProtocol.class)) {
dpnCommunicationService = DpnP4Communicator.getInstance();
+ DpnP4Communicator.getInstance().setDeviceId(DeviceId.deviceId(optionalDpn.get().dpnId().toString()));
} else {
throw new RuntimeException("Control Protocol is not supported.");
}
diff --git a/apps/fpcagent/src/main/java/org/onosproject/fpcagent/protocols/DpnNgicCommunicator.java b/apps/fpcagent/src/main/java/org/onosproject/fpcagent/protocols/DpnNgicCommunicator.java
index 6491882..ba697ed 100644
--- a/apps/fpcagent/src/main/java/org/onosproject/fpcagent/protocols/DpnNgicCommunicator.java
+++ b/apps/fpcagent/src/main/java/org/onosproject/fpcagent/protocols/DpnNgicCommunicator.java
@@ -226,7 +226,12 @@
.put(toUint32(client_id))
.put(toUint32(op_id.longValue()));
- log.info("create_session: {}", bb.array());
+ log.info("create_session(topic_id={}, imsi={}, default_ebi={}, " +
+ "ue_ipv4={}, s1u_sgw_teid={}, s1u_sgw_ipv4={}, " +
+ "session_id={}, client_id={}, op_id={})",
+ topic_id, imsi, default_ebi, ue_ipv4, s1u_sgw_teid,
+ s1u_sgw_ipv4, session_id, client_id, op_id);
+
ZMQSBPublisherManager.getInstance().send(bb);
}
@@ -265,7 +270,12 @@
.put(toUint32(client_id))
.put(toUint32(op_id.longValue()));
- log.info("modify_bearer: {}", bb.array());
+ log.info("modify_bearer(topic_id={}, s1u_sgw_ipv4={}, " +
+ "s1u_enodeb_teid={}, s1u_enodeb_ipv4={}, " +
+ "session_id={}, client_id={}, op_id={})",
+ topic_id, s1u_sgw_ipv4, s1u_enodeb_teid, s1u_enodeb_ipv4,
+ session_id, client_id, op_id);
+
ZMQSBPublisherManager.getInstance().send(bb);
}
@@ -295,7 +305,10 @@
.put(toUint32(client_id))
.put(toUint32(op_id.longValue()));
- log.info("delete_session: {}", bb.array());
+ log.info("delete_session(topic_id={}, session_id={}, client_id={}, " +
+ "op_id={})",
+ topic_id, session_id, client_id, op_id);
+
ZMQSBPublisherManager.getInstance().send(bb);
}
diff --git a/apps/fpcagent/src/main/java/org/onosproject/fpcagent/workers/ZMQSBSubscriberManager.java b/apps/fpcagent/src/main/java/org/onosproject/fpcagent/workers/ZMQSBSubscriberManager.java
index 8207205..265046c 100644
--- a/apps/fpcagent/src/main/java/org/onosproject/fpcagent/workers/ZMQSBSubscriberManager.java
+++ b/apps/fpcagent/src/main/java/org/onosproject/fpcagent/workers/ZMQSBSubscriberManager.java
@@ -202,7 +202,7 @@
short networkIdLen = buf[9 + nodeIdLen];
String deviceId = new String(Arrays.copyOfRange(buf, 9, 9 + nodeIdLen)) + "/" + new String(Arrays.copyOfRange(buf, 10 + nodeIdLen, 10 + nodeIdLen + networkIdLen));
status = DpnStatusIndication.getEnum(buf[3]);
- log.info("topic {}, status {}, source {}, node/net {}", (short) buf[2], status, toInt(buf, 4), deviceId);
+ log.info("topic {}, status {}, source {}, node/net {}", (short) buf[2], status, fromIntToLong(buf, 4), deviceId);
if (status.equals(DpnStatusIndication.HELLO)) {
log.info("Hello {} on topic {}", deviceId, buf[2]);
dpnDeviceListener.deviceAdded(deviceId, buf[2]);
diff --git a/scripts/addDPN.sh b/scripts/addDPN.sh
index 94ceddc..1533f6b 100755
--- a/scripts/addDPN.sh
+++ b/scripts/addDPN.sh
@@ -17,26 +17,6 @@
}
]
}' 'http://192.168.105.14:8181/onos/restconf/data/ietf-dmm-fpcagent:tenants/tenant=default/fpc-topology'
- ./getTenants.sh
- echo ""
-elif [ "$#" -eq 2 ]; then
- echo ""
- curl -i --header "Content-type: application/json" --request POST -u onos:rocks --data '{
- "dpns": [
- {
- "dpn-id": '$1',
- "dpn-name": "site1-anchor1",
- "dpn-groups": [
- "foo"
- ],
- "node-id": "node'$1'",
- "network-id": "network'$1'",
- "control-protocol": "zmq-dpn-control-protocol",
- "abstract": false
- }
- ]
- }' 'http://192.168.105.14:8181/onos/restconf/data/ietf-dmm-fpcagent:tenants/tenant='$2'/fpc-topology'
- ./getTenants.sh
echo ""
else
echo "usage: "$0" dpnId (tenantId)"
diff --git a/scripts/addP4DPN.sh b/scripts/addP4DPN.sh
new file mode 100755
index 0000000..d2b820b
--- /dev/null
+++ b/scripts/addP4DPN.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+if [ "$#" -eq 1 ]; then
+ echo ""
+ curl -i --header "Content-type: application/json" --request POST -u onos:rocks --data '{
+ "dpns": [
+ {
+ "dpn-id": '$1',
+ "dpn-name": "site1-anchor1",
+ "dpn-groups": [
+ "foo"
+ ],
+ "node-id": "node'$1'",
+ "network-id": "network'$1'",
+ "control-protocol": "p4-dpn-control-protocol",
+ "abstract": false
+ }
+ ]
+ }' 'http://192.168.105.14:8181/onos/restconf/data/ietf-dmm-fpcagent:tenants/tenant=default/fpc-topology'
+ echo ""
+else
+ echo "usage: "$0" dpnId (tenantId)"
+fi