Skip to content

Commit

Permalink
docs: add yaml-format md
Browse files Browse the repository at this point in the history
  • Loading branch information
ak1ra24 committed Jan 20, 2020
1 parent 68ef2a1 commit 80451aa
Showing 1 changed file with 121 additions and 0 deletions.
121 changes: 121 additions & 0 deletions docs/specification_yml.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Yaml Format

## Node Definition

### Node type

- name: node name. It will be container-name or netns-name.
- type: node type (default: docker)
- docker: node is docker container
- netns: node is just network namespace
- image: specify docker-image
- sysctls: set sysctls
- mounts: mounts file/directory on the container

```
nodes:
- name: Node0
image: ubuntu:18.04
- name: Node1
type: netns
- name: Node2
build: .
```

### Interface Definition

- type
- direct: p2p connect to other container
- bridge: bridge connection
- phys : host's network interface
- mac: specify mac address

```
nodes:
- name: Node0
image: ubuntu:18.04
interfaces:
- { name: net0, type: direct, args: R0#net1 }
- { name: net0, type: bridge, args: B0 }
- { name: eth0, type: phys }
- { name: net0, type: direct, args: R1#net1, mac: 11:11:11:11:11:11 }
```

### Bridge Definition

If you use the bridge interface type, you need to
define the Bridge-Instance. It'll be created as a
linux bridge instance.

- name: interface name
- type: interface type, you must choose following.
- docker: net-if of docker container
- netns: net-if of network namespace
- phys: host's network interface

```
bridges:
- name: Bridge0
interfaces:
- { name: net0, type: docker, args: R0 }
- { name: net0, type: netns, args: NS0 }
- { name: eth0, type: phys }
```

## Config Definition
- name: node name
- cmds: shell command

```
node_configs:
- name: Router1
cmds:
- cmd: ip addr add 10.255.0.10/32 dev lo
- cmd: ip addr add 10.0.0.10/24 dev net0
- copy: ./config.conf /usr/local/config.conf
- name: Router0
cmds:
- cmd: sysctl -w 'net.ipv4.fib_multipath_hash_policy=1'
- cmd: /usr/lib/frr/frr start
- cmd: ip addr add 10.255.0.1/32 dev lo
- cmd: ip addr add 10.0.0.1/24 dev net0
- cmd: ip addr add 10.1.0.1/24 dev net1
- cmd: >-
vtysh -c 'conf t'
-c 'router bgp 100'
-c ' bgp router-id 10.255.0.1'
-c ' neighbor 10.0.0.10 remote-as 100'
-c ' neighbor 10.0.0.20 remote-as 100'
-c ' neighbor 10.0.0.30 remote-as 100'
```

## Test Definition

- name: test name, you can specify when you run `tn conf -n <name>`
- cmds: same format of config definition

```
test:
- name: p2p
cmds:
- cmd: docker exec S0 ping -c2 10.1.0.1
- cmd: docker exec S1 ping -c2 192.168.0.1
- cmd: docker exec S2 ping -c2 192.168.0.1
- cmd: docker exec S3 ping -c2 192.168.0.1
- name: remote
cmds:
- cmd: docker exec S0 ping -c2 10.1.0.1
- cmd: docker exec S1 ping -c2 192.168.0.1
- cmd: docker exec S2 ping -c2 192.168.0.1
- cmd: docker exec S3 ping -c2 192.168.0.1
```

## System Requirement Definition

```
require:
- kernel_min: 4.11.0
- kernel_max: 4.15.0
- kmod: [ mpls_router, mpls_iptunnel, mpls_gso ]
- kconfig: [ CONFIG_NET_L3_MASTER_DEV ]
```

0 comments on commit 80451aa

Please sign in to comment.