44883ae82175f724b2f24db9f625cd4e45755841
[fuel.git] / mcp / patches / salt-formula-linux / 0002-network-Bring-in-basic-VPP-support.patch
1 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
2 : Copyright (c) 2019 Mirantis Inc., Enea AB and others.
3 :
4 : All rights reserved. This program and the accompanying materials
5 : are made available under the terms of the Apache License, Version 2.0
6 : which accompanies this distribution, and is available at
7 : http://www.apache.org/licenses/LICENSE-2.0
8 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
9 From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
10 Date: Mon, 10 Dec 2018 16:16:26 +0100
11 Subject: [PATCH] network: Bring in basic VPP support
12
13 For now, we only care about DPDK-backed VPP ports.
14
15 TODO:
16 - README.rst: VPP port usage
17
18 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
19 ---
20  linux/files/vpp_commands.txt |  4 ++++
21  linux/files/vpp_startup.conf | 44 ++++++++++++++++++++++++++++++++++++
22  linux/network/dpdk.sls       | 38 +++++++++++++++++++++++++++++++
23  3 files changed, 86 insertions(+)
24  create mode 100644 linux/files/vpp_commands.txt
25  create mode 100644 linux/files/vpp_startup.conf
26
27 diff --git a/linux/files/vpp_commands.txt b/linux/files/vpp_commands.txt
28 new file mode 100644
29 index 0000000..2ce4726
30 --- /dev/null
31 +++ b/linux/files/vpp_commands.txt
32 @@ -0,0 +1,4 @@
33 +{%- from "linux/map.jinja" import network with context %}
34 +{%- if network.vpp.commands is defined %}
35 +{{ network.vpp.commands }}
36 +{%- endif %}
37 diff --git a/linux/files/vpp_startup.conf b/linux/files/vpp_startup.conf
38 new file mode 100644
39 index 0000000..d66ecd3
40 --- /dev/null
41 +++ b/linux/files/vpp_startup.conf
42 @@ -0,0 +1,44 @@
43 +{%- from "linux/map.jinja" import network with context %}
44 +unix {
45 +  cli-listen /run/vpp/cli.sock
46 +  log /var/log/vpp.log
47 +  full-coredump
48 +  nodaemon
49 +  startup-config /etc/vpp/commands.txt
50 +{%- if network.vpp.gid is defined %}
51 +  gid {{ network.vpp.gid }}
52 +{%- endif %}
53 +}
54 +api-trace {
55 +  on
56 +}
57 +{%- if network.vpp.gid is defined %}
58 +api-segment {
59 +  gid {{ network.vpp.gid }}
60 +}
61 +{%- endif %}
62 +cpu {
63 +{%- if network.vpp.main_core is defined %}
64 +  main-core {{ network.vpp.main_core }}
65 +{%- endif %}
66 +{%- if network.vpp.corelist_workers is defined %}
67 +  corelist-workers {{ network.vpp.corelist_workers }}
68 +{%- endif %}
69 +{%- if network.vpp.skip_core is defined %}
70 +  skip-core {{ network.vpp.skip_core }}
71 +{%- endif %}
72 +{%- if network.vpp.workers is defined %}
73 +  workers {{ network.vpp.workers }}
74 +{%- endif %}
75 +}
76 +dpdk {
77 +{%- if network.vpp.dpdk_socket_mem is defined %}
78 +  socket-mem {{ network.vpp.dpdk_socket_mem }}
79 +{%- endif %}
80 +  ## Whitelist specific interface by specifying PCI address
81 +{%- for interface_name, interface in network.interface.items() %}
82 +{%- if 'dpdk_vpp_port' in interface.type and interface.pci is defined %}
83 +  dev {{ interface.pci }}
84 +{%- endif %}
85 +{%- endfor %}
86 +}
87 diff --git a/linux/network/dpdk.sls b/linux/network/dpdk.sls
88 index 786f7c8..09453c6 100644
89 --- a/linux/network/dpdk.sls
90 +++ b/linux/network/dpdk.sls
91 @@ -32,6 +32,44 @@ linux_network_dpdk_service:
92    - watch:
93      - file: /etc/dpdk/interfaces
94
95 +{%- if network.vpp is defined %}
96 +
97 +vpp_pkgs:
98 +  pkg.installed:
99 +  - pkgs:
100 +    - vpp
101 +    - vpp-plugins
102 +    - bridge-utils
103 +
104 +/etc/vpp/commands.txt:
105 +  file.managed:
106 +    - source: salt://linux/files/vpp_commands.txt
107 +    - template: jinja
108 +    - require:
109 +      - pkg: vpp_pkgs
110 +
111 +/etc/vpp/startup.conf:
112 +  file.managed:
113 +    - source: salt://linux/files/vpp_startup.conf
114 +    - template: jinja
115 +    - require:
116 +      - pkg: vpp_pkgs
117 +
118 +/etc/sysctl.d/80-vpp.conf:
119 +  file.managed:
120 +    - contents:
121 +      - '# Disabled by salt-formula-linux'
122 +
123 +linux_network_vpp_service:
124 +  service.running:
125 +  - enable: true
126 +  - name: vpp
127 +  - watch:
128 +    - file: /etc/vpp/startup.conf
129 +    - file: /etc/vpp/commands.txt
130 +
131 +{%- endif %}
132 +
133  {%- if network.openvswitch is defined %}
134
135  openvswitch_dpdk_pkgs: