controller-api-test.sh 653 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/bash
  2. if [ "$#" -ne "2" ]; then
  3. echo 'Usage: controller-api-test.sh <network ID to create> <local TCP port for HTTP API>'
  4. exit 1
  5. fi
  6. network_json=$(cat <<EOF
  7. {
  8. name: "test network",
  9. private: true,
  10. v4AssignMode: "zt",
  11. v6AssignMode: "none",
  12. multicastLimit: 100,
  13. ipAssignmentPools: [
  14. {
  15. network: "10.1.2.0",
  16. netmaskBits: 24
  17. }
  18. ],
  19. rules: [
  20. {
  21. ruleId: 100,
  22. etherType: 0x0800,
  23. action: "accept"
  24. },
  25. {
  26. ruleId: 200,
  27. etherType: 0x0806,
  28. action: "accept"
  29. },
  30. {
  31. ruleId: 300,
  32. etherType: 0x86dd,
  33. action: "accept"
  34. }
  35. ]
  36. }
  37. EOF
  38. )
  39. echo "$network_json" | curl -d - -v "http://127.0.0.1:$2/controller/network/$1"