Skip to content

Commit

Permalink
Contiv spec auto-generation (#53)
Browse files Browse the repository at this point in the history
* Contiv spec auto-generation

1. Auto generation of netmaster.raml from contivModel specification.
This file is generated using contivModel2raml.rb, and needs to be put in
contiv/libraries.
2. Authored contiv.raml specification
3. Authored auth_proxy.raml specification
4. To generate contiv.html, run make docs
  • Loading branch information
rhim authored Feb 17, 2017
1 parent 9b22937 commit ef9d0bf
Show file tree
Hide file tree
Showing 12 changed files with 1,359 additions and 0 deletions.
11 changes: 11 additions & 0 deletions spec/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM node:alpine

RUN npm install -g raml2html

COPY . /contiv

WORKDIR /contiv

RUN raml2html -i contiv.raml -o contiv.html

ENTRYPOINT ["/bin/sh"]
6 changes: 6 additions & 0 deletions spec/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
all: docs

docs:
@./build.sh

.PHONY: docs
8 changes: 8 additions & 0 deletions spec/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

set -euo pipefail

docker build -t contiv/spec .
cid=$(docker run -itd contiv/spec)
docker cp ${cid}:/contiv/contiv.html .
docker rm -f -v ${cid}
280 changes: 280 additions & 0 deletions spec/contiv.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,280 @@
#%RAML 1.0
title: Contiv
description: Contiv API Specification
version: v1
baseUri:
value: http://{serverfqdn}:10000/api/{version}
(rediractable): true
baseUriParameters:
serverfqdn:
type: string
protocols: [ HTTPS ]
mediaType: [ application/json ]

resourceTypes:
collection: !include contiv/schemas/collection.raml
non-upd-collection-item: !include contiv/schemas/non-upd-collection-item.raml
collection-item: !include contiv/schemas/collection-item.raml
ro-collection-item: !include contiv/schemas/ro-collection-item.raml

annotationTypes:
info:
properties:
license:
type: string
enum: [ "Apache 2.0" ]
allowedTargets: API
rediractable: boolean

securitySchemes:
custom_scheme: !include contiv/schemas/custom-scheme.raml

# Resource templates
uses:
auth_proxy: contiv/libraries/auth_proxy.raml
netmaster: contiv/libraries/netmaster.raml

securedBy: custom_scheme

# auth_proxy endpoints
/auth_proxy:
displayName: Auth API
description: Authentication/Authorization related API

/version:
get:
securedBy: [ null ]
responses:
200:
body:
application/json: |
{ "version": "1.0.0-beta" }
/health:
get:
securedBy: [ null ]
responses:
200:
body:
application/json:
type: auth_proxy.health


/login:
post:
description: Login to Contiv API server
securedBy: [ null ]
body:
application/json:
type: auth_proxy.login
responses:
200:
body:
application/json:
type: auth_proxy.login_response
400:
401:

/local_users:
type: {collection: {provider: auth_proxy}}
displayName: Local Users

/{username}:
type: {collection-item: {provider: auth_proxy}}
displayName: Local User

/ldap_configuration:
type: {collection-item: {provider: auth_proxy}}
displayName: LDAP Configuration
put:

/authorizations:
type: {collection: {provider: auth_proxy}}
displayName: Authorizations

/{authzUUID}:
type: {non-upd-collection-item: {provider: auth_proxy}}
displayName: Authorization

#Netmaster endpoints. Most of this can be auto-gen
/inspect:
displayName: Inspect
description: Inspect APIs for various Contiv managed objects

/aciGws:
/aciGw:
type: {ro-collection-item: {provider: netmaster}}
/appProfiles:
/{appProfileName}:
type: {ro-collection-item: {provider: netmaster}}
/{tenantName}:
type: {ro-collection-item: {provider: netmaster}}
/Bgps:
/{hostname}:
type: {ro-collection-item: {provider: netmaster}}
/endpoints:
/{endpointID}:
type: {ro-collection-item: {provider: netmaster}}
/endpointGroups:
/{tenantName}:
type: {ro-collection-item: {provider: netmaster}}
/{groupName}:
type: {ro-collection-item: {provider: netmaster}}
/extContractsGroups:
/{tenantName}:
type: {ro-collection-item: {provider: netmaster}}
/{contractsGroupName}:
type: {ro-collection-item: {provider: netmaster}}
/globals:
/global:
type: {ro-collection-item: {provider: netmaster}}
/netprofiles:
/{tenantName}:
type: {ro-collection-item: {provider: netmaster}}
/{profileName}:
type: {ro-collection-item: {provider: netmaster}}
/networks:
/{tenantName}:
type: {ro-collection-item: {provider: netmaster}}
/{networkName}:
type: {ro-collection-item: {provider: netmaster}}
/policys:
/{tenantName}:
type: {ro-collection-item: {provider: netmaster}}
/{policyName}:
type: {ro-collection-item: {provider: netmaster}}
/rules:
/{tenantName}:
type: {ro-collection-item: {provider: netmaster}}
/{policyName}:
type: {ro-collection-item: {provider: netmaster}}
/{ruleId}:
type: {ro-collection-item: {provider: netmaster}}
/serviceLBs:
/{tenantName}:
type: {ro-collection-item: {provider: netmaster}}
/{serviceName}:
type: {ro-collection-item: {provider: netmaster}}
/tenants:
/{tenantName}:
type: {ro-collection-item: {provider: netmaster}}

/aciGws:
type: {collection: {provider: netmaster}}
displayName: ACI Gateways
description: ACI gateway settings

/aciGw:
type: {collection-item: {provider: netmaster}}
put:

/appProfiles:
type: {collection: {provider: netmaster}}
displayName: Application Profiles

/{tenantName}:
type: {collection-item: {provider: netmaster}}
put:

/{appProfileName}:
type: {collection-item: {provider: netmaster}}
put:

/Bgps:
type: {collection: {provider: netmaster}}
displayName: BGP
description: BGP settings

/{hostname}:
type: {collection-item: {provider: netmaster}}
put:

/endpointGroups:
type: {collection: {provider: netmaster}}
displayName: Endpoint Groups
/{tenantName}:
type: {collection-item: {provider: netmaster}}
put:
/{groupName}:
type: {collection-item: {provider: netmaster}}
put:

/extContractsGroups:
type: {collection: {provider: netmaster}}
displayName: External Contract Groups
/{tenantName}:
type: {collection-item: {provider: netmaster}}
put:
/{contractsGroupName}:
type: {collection-item: {provider: netmaster}}
put:

/globals:
type: {collection: {provider: netmaster}}
displayName: Globals
description: Contiv global settings

/global:
type: {collection-item: {provider: netmaster}}
displayName: Global
put:

/netprofiles:
type: {collection: {provider: netmaster}}
displayName: Network Profiles
/{tenantName}:
type: {collection-item: {provider: netmaster}}
put:
/{profileName}:
type: {collection-item: {provider: netmaster}}
put:

/networks:
type: {collection: {provider: netmaster}}
displayName: Networks
/{tenantName}:
type: {collection-item: {provider: netmaster}}
put:
/{networkName}:
type: {collection-item: {provider: netmaster}}
put:

/policys:
type: {collection: {provider: netmaster}}
displayName: Policies
/{tenantName}:
type: {collection-item: {provider: netmaster}}
put:
/{policyName}:
type: {collection-item: {provider: netmaster}}
put:

/rules:
type: {collection: {provider: netmaster}}
displayName: Rules
/{tenantName}:
type: {collection-item: {provider: netmaster}}
put:
/{policyName}:
type: {collection-item: {provider: netmaster}}
put:
/{ruleId}:
type: {collection-item: {provider: netmaster}}
put:

/serviceLBs:
type: {collection: {provider: netmaster}}
displayName: Service Load Balancers
/{tenantName}:
type: {collection-item: {provider: netmaster}}
put:
/{serviceName}:
type: {collection-item: {provider: netmaster}}
put:

/tenants:
type: {collection: {provider: netmaster}}
displayName: Tenants
/{tenantName}:
type: {collection-item: {provider: netmaster}}
put:
Loading

0 comments on commit ef9d0bf

Please sign in to comment.