The CNWAN Adaptor is part of the Cloud Native SD-WAN (CNWAN) project. Please check the CNWAN documentation for the general project overview and architecture. You can contact the CNWAN team at cnwan@cisco.com.
This CNWAN Adaptor takes as input several cloud parameters, such as endpoint IP and port, and associated metadata (e.g. traffic profiles), and sends them to a SDWAN controller. The controller implements policies to steer traffic flows for these endpoints to the desired tunnel or apply a SLA on them.
The adaptor needs valid credentials for the SDWAN controller (user, password and IP or domain name).
To see all the possible API calls, run the adaptor and type http://localhost:80/ui/
in your browser. In addition, the file CNWAN Adaptor.postman_collection.json
contains a Postman collection with examples of all the API functions. In particular, the Adaptor provides the /cnwan/events
API endpoint (e.g. http://localhost:80/cnwan/events
) for the CNWAN Reader to send events.
Docker Engine 19.03.8+
The adaptor runs in a Docker container:
# build the image
docker build -t cnwan_adaptor .
# starting up a container
docker run -p 80:8080 cnwan_adaptor
It is possible to specify the SDWAN controller credentials through environment variables:
docker run -p 80:8080 \
-e SDWAN_IP=sample.server.com \
-e SDWAN_USERNAME=user \
-e SDWAN_PASSWORD=xxxxx \
-e MERGE_POLICY=merge_policy_name \
cnwan_adaptor
The adaptor makes the following assumptions regarding the controller configuration:
- The
policyName
variable in themappings
schema corresponds to a previously defined policy in the controller, containing its tunnel or SLA. - The
sdwanMergedPolicyName
variable in thecredentials
schema corresponds to another traffic policy that will be used to merge all the policies into a single one, so it can be activated. - The mapping of
metadataValue
topolicyName
is 1:1 (two metadata values cannot share the samepolicyName
). On the other hand, a singlemetadataKey
supports any number ofmetadataValue
.
This adaptor was generated by the swagger-codegen project. By using the OpenAPI-Spec from a remote server, you can easily generate a server stub. This is an example of building a swagger-enabled Flask server. This example uses the Connexion library on top of Flask.
It is possible to use the metadata_adaptor python library without the server. It exposes several high level functions equivalent to he ones in the adaptor. To use the library:
cd adaptor_library
# Generate the package
python3 setup.py sdist bdist_wheel
# Install the package
pip3 install requests
pip3 install dist/metadata_adaptor-2.0.0.tar.gz
# Use the library
python3
import metadata_adaptor.core_lib as sdwan
api = sdwan.api_endpoint()
# Example 1: configure controller credentials
cred = {
"user": "XXXXXX",
"password": "XXXXXX",
"sdwanControllerIpAddress": "sample.server.com",
"sdwanMergedPolicyName" : "your_merge_policy"
}
api.post_credentials(cred)
# Example 2: create a new mapping
mapping = {
'metadataKey' : 'traffic-profile',
'metadataValue' : 'nice_name_to_remember_your_mapping',
'policyType' : 'Data',
'policyName' : 'sample_policy_in_controller'
}
api.post_mapping(mapping)
The library functions are in adaptor_library/metadata_adaptor/core_lib.py