| ... | ... |
@@ -21,6 +21,7 @@ import ( |
| 21 | 21 |
imageapi "github.com/openshift/origin/pkg/image/api" |
| 22 | 22 |
projectapi "github.com/openshift/origin/pkg/project/api" |
| 23 | 23 |
routeapi "github.com/openshift/origin/pkg/route/api" |
| 24 |
+ sdnapi "github.com/openshift/origin/pkg/sdn/api" |
|
| 24 | 25 |
templateapi "github.com/openshift/origin/pkg/template/api" |
| 25 | 26 |
|
| 26 | 27 |
// install all APIs |
| ... | ... |
@@ -125,6 +126,7 @@ func TestExampleObjectSchemas(t *testing.T) {
|
| 125 | 125 |
"test-service-with-finalizer": &kapi.Service{},
|
| 126 | 126 |
"test-buildcli": &kapi.List{},
|
| 127 | 127 |
"test-buildcli-beta2": &kapi.List{},
|
| 128 |
+ "test-egress-network-policy": &sdnapi.EgressNetworkPolicy{},
|
|
| 128 | 129 |
}, |
| 129 | 130 |
"../test/templates/testdata": {
|
| 130 | 131 |
"crunchydata-pod": nil, // Explicitly fails validation, but should pass transformation |
| ... | ... |
@@ -10,7 +10,7 @@ os::cmd::expect_failure_and_text 'oc patch clusternetwork default -p "{\"network
|
| 10 | 10 |
os::cmd::expect_failure_and_text 'oc patch clusternetwork default -p "{\"hostsubnetlength\": 22}"' 'Invalid value'
|
| 11 | 11 |
os::cmd::expect_failure_and_text 'oc patch clusternetwork default -p "{\"serviceNetwork\": \"1.0.0.0/8\"}"' 'Invalid value'
|
| 12 | 12 |
|
| 13 |
-orig_project=$(oc project -q) |
|
| 13 |
+orig_project="$(oc project -q)" |
|
| 14 | 14 |
|
| 15 | 15 |
os::cmd::expect_success 'oc get netnamespaces' |
| 16 | 16 |
os::cmd::expect_success_and_text 'oc get netnamespace default -o jsonpath="{.netid}"' '^0$'
|
| ... | ... |
@@ -22,15 +22,14 @@ os::cmd::expect_success_and_not_text 'oc get netnamespace sdn-test -o jsonpath=" |
| 22 | 22 |
os::cmd::expect_success 'oc delete namespace sdn-test' |
| 23 | 23 |
os::cmd::try_until_failure 'oc get netnamespace sdn-test' |
| 24 | 24 |
|
| 25 |
-os::cmd::expect_success 'oc project ${orig_project}'
|
|
| 25 |
+os::cmd::expect_success "oc project '${orig_project}'"
|
|
| 26 | 26 |
|
| 27 | 27 |
# test-cmd environment has no nodes, hence no hostsubnets |
| 28 | 28 |
os::cmd::expect_success_and_not_text 'oc get hostsubnets' '.' |
| 29 | 29 |
|
| 30 |
-policy='{"kind": "EgressNetworkPolicy", "metadata": {"name": "default"}, "spec": {"egress": [{"type": "Allow", "to": {"cidrSelector": "192.168.0.0/16"}}, {"type": "Deny", "to": {"cidrSelector": "0.0.0.0/0"}}]}}'
|
|
| 31 | 30 |
os::cmd::expect_success 'oc get egressnetworkpolicies' |
| 32 | 31 |
os::cmd::expect_failure 'oc get egressnetworkpolicy default' |
| 33 |
-os::cmd::expect_success 'echo "${policy}" | oc create -f -'
|
|
| 32 |
+os::cmd::expect_success 'oc create -f test/integration/testdata/test-egress-network-policy.json' |
|
| 34 | 33 |
os::cmd::expect_success 'oc get egressnetworkpolicy default' |
| 35 | 34 |
os::cmd::expect_success 'oc delete egressnetworkpolicy default' |
| 36 | 35 |
|
| 37 | 36 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,23 @@ |
| 0 |
+{
|
|
| 1 |
+ "kind": "EgressNetworkPolicy", |
|
| 2 |
+ "apiVersion": "v1", |
|
| 3 |
+ "metadata": {
|
|
| 4 |
+ "name": "default" |
|
| 5 |
+ }, |
|
| 6 |
+ "spec": {
|
|
| 7 |
+ "egress": [ |
|
| 8 |
+ {
|
|
| 9 |
+ "type": "Allow", |
|
| 10 |
+ "to": {
|
|
| 11 |
+ "cidrSelector": "192.168.0.0/16" |
|
| 12 |
+ } |
|
| 13 |
+ }, |
|
| 14 |
+ {
|
|
| 15 |
+ "type": "Deny", |
|
| 16 |
+ "to": {
|
|
| 17 |
+ "cidrSelector": "0.0.0.0/0" |
|
| 18 |
+ } |
|
| 19 |
+ } |
|
| 20 |
+ ] |
|
| 21 |
+ } |
|
| 22 |
+} |