Skip to content

Commit e4c2c2b

Browse files
authored
Merge pull request #1084 from dseevr-dev/subtree_contivmodel
Subtree contivmodel into netplugin
2 parents 2e310d6 + 2b79970 commit e4c2c2b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+19653
-1
lines changed

Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
DEFAULT_DOCKER_VERSION := 1.12.6
99
V2PLUGIN_DOCKER_VERSION := 1.13.1
1010
SHELL := /bin/bash
11-
EXCLUDE_DIRS := bin docs Godeps scripts vagrant vendor install
11+
# TODO: contivmodel should be removed once its code passes golint and misspell
12+
EXCLUDE_DIRS := bin docs Godeps scripts vagrant vendor install contivmodel
1213
PKG_DIRS := $(filter-out $(EXCLUDE_DIRS),$(subst /,,$(sort $(dir $(wildcard */)))))
1314
TO_BUILD := ./netplugin/ ./netmaster/ ./netctl/netctl/ ./mgmtfn/k8splugin/contivk8s/ ./mgmtfn/mesosplugin/netcontiv/
1415
HOST_GOBIN := `if [ -n "$$(go env GOBIN)" ]; then go env GOBIN; else dirname $$(which go); fi`

contivmodel/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# data is extracted from this file and merged into spec/docs/contiv.html as part of the build process
2+
# but we don't actually need to keep it around.
3+
spec/docs/auth_proxy.html

contivmodel/LICENSE

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 2017 Cisco Systems Inc. All rights reserved.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
8+
Unless required by applicable law or agreed to in writing, software
9+
distributed under the License is distributed on an "AS IS" BASIS,
10+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
See the License for the specific language governing permissions and
12+
limitations under the License.
13+

contivmodel/Makefile

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
.PHONY: all build godep modelgen systemtests
3+
4+
all: build
5+
6+
build: modelgen
7+
@bash ./scripts/build.sh
8+
9+
godep:
10+
godep save ./...
11+
12+
modelgen:
13+
@if [ -z "`which modelgen`" ]; then go get -v github.com/contiv/modelgen; fi
14+
15+
# systemtest runs all of the systemtests
16+
systemtests:
17+
go test -v -timeout 5m ./systemtests -check.v

contivmodel/README.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
[![GoDoc](https://godoc.org/github.com/contiv/contivmodel/client?status.png)](https://godoc.org/github.com/contiv/contivmodel/client)
2+
3+
# Contiv Object Model
4+
This is how current object model looks like:
5+
6+
![Contiv Object Model](./contivModel.png "Contiv Object Model")
7+
8+
### Using go client
9+
Here is an example of how to use contiv go client
10+
11+
```
12+
package main
13+
14+
import (
15+
"log"
16+
17+
"github.com/contiv/contivModel/client"
18+
)
19+
20+
func main() {
21+
cl, err := client.NewContivClient("localhost:9999")
22+
if err != nil {
23+
log.Fatal(err)
24+
}
25+
26+
// Define a policy
27+
policy := client.Policy{
28+
TenantName: "tenant1",
29+
PolicyName: "policy",
30+
}
31+
32+
// Create policy
33+
err = cl.PostPolicy(policy)
34+
if err != nil {
35+
log.Errorf("Policy Creation failed. Err: %v", err)
36+
}
37+
}
38+
```

contivmodel/aciGw.json

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"name": "contivModel",
3+
"objects": [
4+
{
5+
"name": "aciGw",
6+
"version": "v1",
7+
"type": "object",
8+
"key": [ "name"],
9+
"cfgProperties": {
10+
"name": {
11+
"type": "string",
12+
"title": "name of this block(must be 'aciGw')",
13+
"length": 64,
14+
"format": "^(aciGw)$",
15+
"ShowSummary": true
16+
},
17+
"pathBindings": {
18+
"type": "string",
19+
"title": "List of ACI fabric ports connected to cluster",
20+
"length": 2048,
21+
"format": "^$|^(topology/pod-[0-9]{1,4}/paths-[0-9]{1,4}/pathep-\\\\[eth[0-9]{1,2}/[0-9]{1,2}\\\\]){1}(,topology/pod-[0-9]{1,4}/paths-[0-9]{1,4}/pathep-\\\\[eth[0-9]{1,2}/[0-9]{1,2}\\\\])*$",
22+
"ShowSummary": true
23+
},
24+
"nodeBindings": {
25+
"type": "string",
26+
"title": "List of ACI complete nodes to be bound",
27+
"length": 2048,
28+
"format": "^$|^(topology/pod-[0-9]{1,4}/node-[0-9]{1,4}){1}(,topology/pod-[0-9]{1,4}/node-[0-9]{1,4})*$",
29+
"ShowSummary": true
30+
},
31+
"physicalDomain": {
32+
"type": "string",
33+
"title": "Name of the physical domain",
34+
"length": 128,
35+
"format": "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])$"
36+
},
37+
"enforcePolicies": {
38+
"type": "string",
39+
"title": "Enforce security policy",
40+
"length": 64,
41+
"format": "^(yes|no){1}$",
42+
"ShowSummary": true
43+
},
44+
"includeCommonTenant": {
45+
"type": "string",
46+
"title": "Include common tenant when searching for objects",
47+
"length": 64,
48+
"format": "^(yes|no){1}$",
49+
"ShowSummary": true
50+
}
51+
},
52+
"operProperties": {
53+
"numAppProfiles": {
54+
"type": "int"
55+
}
56+
}
57+
}
58+
]
59+
}

contivmodel/appProfile.json

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"name": "contivModel",
3+
"objects": [
4+
{
5+
"name": "appProfile",
6+
"type": "object",
7+
"version": "v1",
8+
"key": [ "tenantName", "appProfileName" ],
9+
"cfgProperties": {
10+
"tenantName": {
11+
"type": "string",
12+
"title": "Tenant Name",
13+
"length": 64,
14+
"format": "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])$"
15+
},
16+
"appProfileName": {
17+
"type": "string",
18+
"title": "Application Profile Name",
19+
"length": 64,
20+
"format": "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])$"
21+
},
22+
"endpointGroups": {
23+
"type": "array",
24+
"items": "string",
25+
"title": "Member groups of the appProf"
26+
}
27+
},
28+
"link-sets": {
29+
"endpointGroups": {
30+
"ref": "endpointGroup"
31+
}
32+
},
33+
"links": {
34+
"tenant": {
35+
"ref": "tenant"
36+
}
37+
}
38+
}
39+
]
40+
}

contivmodel/bgphost.json

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"name": "contivModel",
3+
"objects": [{
4+
"name": "Bgp",
5+
"version": "v1",
6+
"type": "object",
7+
"key": ["hostname"],
8+
"cfgProperties": {
9+
"hostname": {
10+
"type": "string",
11+
"title": "host name",
12+
"length": 256,
13+
"format": "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])$"
14+
},
15+
"routerip": {
16+
"type": "string",
17+
"title": "Bgp router intf ip",
18+
"format": "^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\\\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3})(\\\\-(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9]))?/(3[0-1]|2[0-9]|1[0-9]|[1-9])$"
19+
},
20+
"as": {
21+
"type": "string",
22+
"title": "AS id",
23+
"length": 64
24+
},
25+
"neighbor-as": {
26+
"type": "string",
27+
"title": "AS id",
28+
"length": 64
29+
},
30+
"neighbor": {
31+
"type": "string",
32+
"title": "Bgp neighbor",
33+
"length": 15,
34+
"format": "^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\\\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3})?$"
35+
}
36+
},
37+
"operProperties": {
38+
"numRoutes": {
39+
"type": "int",
40+
"title": "number of routes"
41+
},
42+
"neighborStatus": {
43+
"type": "string",
44+
"title": "neighbor status"
45+
},
46+
"adminStatus": {
47+
"type": "string",
48+
"title": "admin status"
49+
},
50+
"routes": {
51+
"type": "array",
52+
"items": "string",
53+
"title": "routes"
54+
}
55+
}
56+
}]
57+
}

0 commit comments

Comments
 (0)