PHYSICAL_NETWORK="http://%s:8181/restconf/config/generic-physical-network:physical-network"
def create_physical_network(contHost):
- data={
- "physical-network": {
- "physical-hosts": {
- "physical-host": [
- {
- "host-id": "22282cca-9a13-4d0c-a67e-a933ebb0b0ae",
- "node-id": "openflow:2",
- "host-name": "video-server2",
- "mac-address": "00:00:00:00:00:04",
- "port-id": "openflow:2:2",
- "ip-addresses": {
- "ip-address": [
- "192.168.12.4"
- ]
- }
- },
- {
- "host-id": "7b796915-adf4-4356-b5ca-de005ac410c1",
- "node-id": "openflow:1",
- "host-name": "video-server1",
- "mac-address": "00:00:00:00:00:01",
- "port-id": "openflow:1:1",
- "ip-addresses": {
- "ip-address": [
- "192.168.11.2"
- ]
- }
- },
- {
- "host-id": "6c787caa-156a-49ed-8546-547bdccf283c",
- "node-id": "openflow:2",
- "host-name": "vm2",
- "mac-address": "00:00:00:00:00:03",
- "port-id": "openflow:2:1",
- "ip-addresses": {
- "ip-address": [
- "192.168.12.3"
- ]
- }
- },
- {
- "host-id": "1eaf9a67-a171-42a8-9282-71cf702f61dd",
- "node-id": "openflow:1",
- "host-name": "vm1",
- "mac-address": "00:00:00:00:00:02",
- "port-id": "openflow:1:2",
- "ip-addresses": {
- "ip-address": [
- "192.168.12.2"
- ]
- }
- }
- ]
- },
- "physical-nodes": {
- "physical-node": [
- {
- "node-id": "openflow:3",
- "attribute": [
- {
- "attribute-name": "location",
- "attribute-value": {
- "string-value": "openflow:3"
- }
- }
- ],
- "node-type": "router",
- "physical-port": [
- {
- "port-id": "openflow:3:1",
- "attribute": [
- {
- "attribute-name": "location",
- "attribute-value": {
- "string-value": "openflow:3:1"
- }
- }
- ],
- "port-type": "internal",
- "mac-address": "BE:DB:79:24:0A:B1",
- "bandwidth": 10240
- },
- {
- "port-id": "openflow:3:2",
- "attribute": [
- {
- "attribute-name": "location",
- "attribute-value": {
- "string-value": "openflow:3:2"
- }
- }
- ],
- "port-type": "internal",
- "mac-address": "06:E7:27:6D:C2:A5",
- "bandwidth": 10240
- },
- {
- "port-id": "openflow:3:3",
- "attribute": [
- {
- "attribute-name": "location",
- "attribute-value": {
- "string-value": "openflow:3:3"
- }
- }
- ],
- "port-type": "internal",
- "mac-address": "9E:00:76:D7:0C:1D",
- "bandwidth": 10240
- },
- {
- "port-id": "openflow:3:4",
- "attribute": [
- {
- "attribute-name": "location",
- "attribute-value": {
- "string-value": "openflow:3:4"
- }
- }
- ],
- "port-type": "external",
- "mac-address": "00:00:00:00:03:04",
- "bandwidth": 10240
- }
- ]
- },
- {
- "node-id": "openflow:4",
- "attribute": [
- {
- "attribute-name": "location",
- "attribute-value": {
- "string-value": "openflow:4"
- }
- }
- ],
- "node-type": "router",
- "physical-port": [
- {
- "port-id": "openflow:4:2",
- "attribute": [
- {
- "attribute-name": "location",
- "attribute-value": {
- "string-value": "openflow:4:2"
- }
- }
- ],
- "port-type": "external",
- "mac-address": "00:00:00:00:04:02",
- "bandwidth": 10240
- },
- {
- "port-id": "openflow:4:1",
- "attribute": [
- {
- "attribute-name": "location",
- "attribute-value": {
- "string-value": "openflow:4:1"
- }
- }
- ],
- "port-type": "internal",
- "mac-address": "4E:93:BE:EF:99:35",
- "bandwidth": 10240
- }
- ]
- },
- {
- "node-id": "openflow:1",
- "attribute": [
- {
- "attribute-name": "location",
- "attribute-value": {
- "string-value": "openflow:1"
- }
- }
- ],
- "node-type": "switch",
- "physical-port": [
- {
- "port-id": "openflow:1:1",
- "attribute": [
- {
- "attribute-name": "location",
- "attribute-value": {
- "string-value": "openflow:1:1"
- }
- }
- ],
- "port-type": "external",
- "mac-address": "BA:8C:1F:60:2C:FC",
- "bandwidth": 10240
- },
- {
- "port-id": "openflow:1:2",
- "attribute": [
- {
- "attribute-name": "location",
- "attribute-value": {
- "string-value": "openflow:1:2"
- }
- }
- ],
- "port-type": "external",
- "mac-address": "82:ED:57:DE:28:F0",
- "bandwidth": 10240
- },
- {
- "port-id": "openflow:1:3",
- "attribute": [
- {
- "attribute-name": "location",
- "attribute-value": {
- "string-value": "openflow:1:3"
- }
- }
- ],
- "port-type": "internal",
- "mac-address": "62:D3:F1:80:06:F0",
- "bandwidth": 10240
- }
- ]
- },
- {
- "node-id": "openflow:2",
- "attribute": [
- {
- "attribute-name": "location",
- "attribute-value": {
- "string-value": "openflow:2"
- }
- }
- ],
- "node-type": "switch",
- "physical-port": [
- {
- "port-id": "openflow:2:3",
- "attribute": [
- {
- "attribute-name": "location",
- "attribute-value": {
- "string-value": "openflow:2:3"
- }
- }
- ],
- "port-type": "internal",
- "mac-address": "42:33:22:43:EF:02",
- "bandwidth": 10240
- },
- {
- "port-id": "openflow:2:2",
- "attribute": [
- {
- "attribute-name": "location",
- "attribute-value": {
- "string-value": "openflow:2:2"
- }
- }
- ],
- "port-type": "external",
- "mac-address": "32:7C:45:B9:ED:18",
- "bandwidth": 10240
- },
- {
- "port-id": "openflow:2:1",
- "attribute": [
- {
- "attribute-name": "location",
- "attribute-value": {
- "string-value": "openflow:2:1"
- }
- }
- ],
- "port-type": "external",
- "mac-address": "D6:86:A8:54:2B:32",
- "bandwidth": 10240
- }
- ]
- }
- ]
- },
- "physical-links": {
- "physical-link": [
- {
- "link-id": "openflow:4:1",
- "loss-rate": 1,
- "delay": 1,
- "src-port-id": "openflow:4:1",
- "dest-node-id": "openflow:3",
- "metric": 1,
- "dest-port-id": "openflow:3:3",
- "bandwidth": 10240,
- "src-node-id": "openflow:4"
- },
- {
- "link-id": "openflow:2:3",
- "loss-rate": 1,
- "delay": 1,
- "src-port-id": "openflow:2:3",
- "dest-node-id": "openflow:3",
- "metric": 1,
- "dest-port-id": "openflow:3:2",
- "bandwidth": 10240,
- "src-node-id": "openflow:2"
- },
- {
- "link-id": "openflow:3:1",
- "loss-rate": 1,
- "delay": 1,
- "src-port-id": "openflow:3:1",
- "dest-node-id": "openflow:1",
- "metric": 1,
- "dest-port-id": "openflow:1:3",
- "bandwidth": 10240,
- "src-node-id": "openflow:3"
- },
- {
- "link-id": "openflow:1:3",
- "loss-rate": 1,
- "delay": 1,
- "src-port-id": "openflow:1:3",
- "dest-node-id": "openflow:3",
- "metric": 1,
- "dest-port-id": "openflow:3:1",
- "bandwidth": 10240,
- "src-node-id": "openflow:1"
- },
- {
- "link-id": "openflow:3:3",
- "loss-rate": 1,
- "delay": 1,
- "src-port-id": "openflow:3:3",
- "dest-node-id": "openflow:4",
- "metric": 1,
- "dest-port-id": "openflow:4:1",
- "bandwidth": 10240,
- "src-node-id": "openflow:3"
- },
- {
- "link-id": "openflow:3:2",
- "loss-rate": 1,
- "delay": 1,
- "src-port-id": "openflow:3:2",
- "dest-node-id": "openflow:2",
- "metric": 1,
- "dest-port-id": "openflow:2:3",
- "bandwidth": 10240,
- "src-node-id": "openflow:3"
- }
- ]
- }
- }
- }
+ data={
+ "physical-network": {
+ "physical-hosts": {
+ "physical-host": [
+ {
+ "host-id": "22282cca-9a13-4d0c-a67e-a933ebb0b0ae",
+ "node-id": "openflow:2",
+ "host-name": "video-server2",
+ "mac-address": "00:00:00:00:00:04",
+ "port-id": "openflow:2:2",
+ "ip-addresses": {
+ "ip-address": [
+ "192.168.12.4"
+ ]
+ }
+ },
+ {
+ "host-id": "7b796915-adf4-4356-b5ca-de005ac410c1",
+ "node-id": "openflow:1",
+ "host-name": "video-server1",
+ "mac-address": "00:00:00:00:00:01",
+ "port-id": "openflow:1:1",
+ "ip-addresses": {
+ "ip-address": [
+ "192.168.11.2"
+ ]
+ }
+ },
+ {
+ "host-id": "6c787caa-156a-49ed-8546-547bdccf283c",
+ "node-id": "openflow:2",
+ "host-name": "vm2",
+ "mac-address": "00:00:00:00:00:03",
+ "port-id": "openflow:2:1",
+ "ip-addresses": {
+ "ip-address": [
+ "192.168.12.3"
+ ]
+ }
+ },
+ {
+ "host-id": "1eaf9a67-a171-42a8-9282-71cf702f61dd",
+ "node-id": "openflow:1",
+ "host-name": "vm1",
+ "mac-address": "00:00:00:00:00:02",
+ "port-id": "openflow:1:2",
+ "ip-addresses": {
+ "ip-address": [
+ "192.168.12.2"
+ ]
+ }
+ }
+ ]
+ },
+ "physical-nodes": {
+ "physical-node": [
+ {
+ "node-id": "openflow:3",
+ "attribute": [
+ {
+ "attribute-name": "location",
+ "attribute-value": {
+ "string-value": "openflow:3"
+ }
+ }
+ ],
+ "node-type": "router",
+ "physical-port": [
+ {
+ "port-id": "openflow:3:1",
+ "attribute": [
+ {
+ "attribute-name": "location",
+ "attribute-value": {
+ "string-value": "openflow:3:1"
+ }
+ }
+ ],
+ "port-type": "internal",
+ "mac-address": "BE:DB:79:24:0A:B1",
+ "bandwidth": 10240
+ },
+ {
+ "port-id": "openflow:3:2",
+ "attribute": [
+ {
+ "attribute-name": "location",
+ "attribute-value": {
+ "string-value": "openflow:3:2"
+ }
+ }
+ ],
+ "port-type": "internal",
+ "mac-address": "06:E7:27:6D:C2:A5",
+ "bandwidth": 10240
+ },
+ {
+ "port-id": "openflow:3:3",
+ "attribute": [
+ {
+ "attribute-name": "location",
+ "attribute-value": {
+ "string-value": "openflow:3:3"
+ }
+ }
+ ],
+ "port-type": "internal",
+ "mac-address": "9E:00:76:D7:0C:1D",
+ "bandwidth": 10240
+ },
+ {
+ "port-id": "openflow:3:4",
+ "attribute": [
+ {
+ "attribute-name": "location",
+ "attribute-value": {
+ "string-value": "openflow:3:4"
+ }
+ }
+ ],
+ "port-type": "external",
+ "mac-address": "00:00:00:00:03:04",
+ "bandwidth": 10240
+ }
+ ]
+ },
+ {
+ "node-id": "openflow:4",
+ "attribute": [
+ {
+ "attribute-name": "location",
+ "attribute-value": {
+ "string-value": "openflow:4"
+ }
+ }
+ ],
+ "node-type": "router",
+ "physical-port": [
+ {
+ "port-id": "openflow:4:2",
+ "attribute": [
+ {
+ "attribute-name": "location",
+ "attribute-value": {
+ "string-value": "openflow:4:2"
+ }
+ }
+ ],
+ "port-type": "external",
+ "mac-address": "00:00:00:00:04:02",
+ "bandwidth": 10240
+ },
+ {
+ "port-id": "openflow:4:1",
+ "attribute": [
+ {
+ "attribute-name": "location",
+ "attribute-value": {
+ "string-value": "openflow:4:1"
+ }
+ }
+ ],
+ "port-type": "internal",
+ "mac-address": "4E:93:BE:EF:99:35",
+ "bandwidth": 10240
+ }
+ ]
+ },
+ {
+ "node-id": "openflow:1",
+ "attribute": [
+ {
+ "attribute-name": "location",
+ "attribute-value": {
+ "string-value": "openflow:1"
+ }
+ }
+ ],
+ "node-type": "switch",
+ "physical-port": [
+ {
+ "port-id": "openflow:1:1",
+ "attribute": [
+ {
+ "attribute-name": "location",
+ "attribute-value": {
+ "string-value": "openflow:1:1"
+ }
+ }
+ ],
+ "port-type": "external",
+ "mac-address": "BA:8C:1F:60:2C:FC",
+ "bandwidth": 10240
+ },
+ {
+ "port-id": "openflow:1:2",
+ "attribute": [
+ {
+ "attribute-name": "location",
+ "attribute-value": {
+ "string-value": "openflow:1:2"
+ }
+ }
+ ],
+ "port-type": "external",
+ "mac-address": "82:ED:57:DE:28:F0",
+ "bandwidth": 10240
+ },
+ {
+ "port-id": "openflow:1:3",
+ "attribute": [
+ {
+ "attribute-name": "location",
+ "attribute-value": {
+ "string-value": "openflow:1:3"
+ }
+ }
+ ],
+ "port-type": "internal",
+ "mac-address": "62:D3:F1:80:06:F0",
+ "bandwidth": 10240
+ }
+ ]
+ },
+ {
+ "node-id": "openflow:2",
+ "attribute": [
+ {
+ "attribute-name": "location",
+ "attribute-value": {
+ "string-value": "openflow:2"
+ }
+ }
+ ],
+ "node-type": "switch",
+ "physical-port": [
+ {
+ "port-id": "openflow:2:3",
+ "attribute": [
+ {
+ "attribute-name": "location",
+ "attribute-value": {
+ "string-value": "openflow:2:3"
+ }
+ }
+ ],
+ "port-type": "internal",
+ "mac-address": "42:33:22:43:EF:02",
+ "bandwidth": 10240
+ },
+ {
+ "port-id": "openflow:2:2",
+ "attribute": [
+ {
+ "attribute-name": "location",
+ "attribute-value": {
+ "string-value": "openflow:2:2"
+ }
+ }
+ ],
+ "port-type": "external",
+ "mac-address": "32:7C:45:B9:ED:18",
+ "bandwidth": 10240
+ },
+ {
+ "port-id": "openflow:2:1",
+ "attribute": [
+ {
+ "attribute-name": "location",
+ "attribute-value": {
+ "string-value": "openflow:2:1"
+ }
+ }
+ ],
+ "port-type": "external",
+ "mac-address": "D6:86:A8:54:2B:32",
+ "bandwidth": 10240
+ }
+ ]
+ }
+ ]
+ },
+ "physical-links": {
+ "physical-link": [
+ {
+ "link-id": "openflow:4:1",
+ "loss-rate": 1,
+ "delay": 1,
+ "src-port-id": "openflow:4:1",
+ "dest-node-id": "openflow:3",
+ "metric": 1,
+ "dest-port-id": "openflow:3:3",
+ "bandwidth": 10240,
+ "src-node-id": "openflow:4"
+ },
+ {
+ "link-id": "openflow:2:3",
+ "loss-rate": 1,
+ "delay": 1,
+ "src-port-id": "openflow:2:3",
+ "dest-node-id": "openflow:3",
+ "metric": 1,
+ "dest-port-id": "openflow:3:2",
+ "bandwidth": 10240,
+ "src-node-id": "openflow:2"
+ },
+ {
+ "link-id": "openflow:3:1",
+ "loss-rate": 1,
+ "delay": 1,
+ "src-port-id": "openflow:3:1",
+ "dest-node-id": "openflow:1",
+ "metric": 1,
+ "dest-port-id": "openflow:1:3",
+ "bandwidth": 10240,
+ "src-node-id": "openflow:3"
+ },
+ {
+ "link-id": "openflow:1:3",
+ "loss-rate": 1,
+ "delay": 1,
+ "src-port-id": "openflow:1:3",
+ "dest-node-id": "openflow:3",
+ "metric": 1,
+ "dest-port-id": "openflow:3:1",
+ "bandwidth": 10240,
+ "src-node-id": "openflow:1"
+ },
+ {
+ "link-id": "openflow:3:3",
+ "loss-rate": 1,
+ "delay": 1,
+ "src-port-id": "openflow:3:3",
+ "dest-node-id": "openflow:4",
+ "metric": 1,
+ "dest-port-id": "openflow:4:1",
+ "bandwidth": 10240,
+ "src-node-id": "openflow:3"
+ },
+ {
+ "link-id": "openflow:3:2",
+ "loss-rate": 1,
+ "delay": 1,
+ "src-port-id": "openflow:3:2",
+ "dest-node-id": "openflow:2",
+ "metric": 1,
+ "dest-port-id": "openflow:2:3",
+ "bandwidth": 10240,
+ "src-node-id": "openflow:3"
+ }
+ ]
+ }
+ }
+ }
put(PHYSICAL_NETWORK % contHost, data)
# CREATE User;
register_user(args.controller)
-
transaction_begin(args.controller)
# IMPORT Node server1 Type host;