This commit is contained in:
zhangzhihan
2020-06-24 18:08:40 +08:00
parent e1dc6b5f62
commit e6fbb265a8
23 changed files with 83 additions and 71 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -1,9 +1,9 @@
######################################### #########################################
#####0: Pcap; 1: Inline_device; 2: Allot; 3: ADC_Tun_mode; 4: ATCA; #####0: Pcap; 1: Inline_device; 2: Allot; 3: ADC_Tun_mode; 4: ATCA;
tsg_access_type: 0 tsg_access_type: 4
#####0: Tun_mode; 1: ADC; #####0: Tun_mode; 1: normal; 2: ADC;
tsg_running_type: 0 tsg_running_type: 1
######################################## ########################################
maat_redis_server: maat_redis_server:
@@ -21,7 +21,7 @@ cert_store_server:
port: 9991 port: 9991
log_kafkabrokers: log_kafkabrokers:
address: "192.168.40.169:9092" address: "1.1.1.1:9092,2.2.2.2:9092"
log_minio: log_minio:
address: "192.168.40.168;" address: "192.168.40.168;"
@@ -35,7 +35,9 @@ fs_remote:
######################################## ########################################
sapp: sapp:
worker_threads: 16 worker_threads: 16
send_only_threads_max: 8
bind_mask: 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 bind_mask: 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16
inbound_route_dir: 1
######################################## ########################################
kni: kni:
@@ -49,12 +51,9 @@ kni:
send_logger: send_logger:
switch: 1 switch: 1
tfe_nodes: tfe_nodes:
- tfe0: tfe0_enabled: 1
enabled: 1 tfe1_enabled: 1
- tfe1: tfe2_enabled: 1
enabled: 1
- tfe2:
enabled: 1
######################################## ########################################
tfe: tfe:
@@ -72,7 +71,7 @@ mrtunnat:
lcore_id: 38 lcore_id: 38
nic_data_incoming: nic_data_incoming:
name: enp1s0 ethname: enp1s0
vf0_name: enp1s2 vf0_name: enp1s2
vf1_name: enp1s2f1 vf1_name: enp1s2f1
vf2_name: enp1s2f2 vf2_name: enp1s2f2
@@ -80,8 +79,10 @@ nic_data_incoming:
VlanFlipping: VlanFlipping:
vlanID_1: 100 vlanID_1: 100
vlanID_2: 101 vlanID_2: 101
vlanID_3: 103
vlanID_4: 104
######################################## ########################################
tsg_tun_mode: server:
ethname: eth0 ethname: eth0
tun_name: eth0.100 tun_name: eth0.100
internal_interface: "eth2" internal_interface: "eth2"

BIN
roles/.DS_Store vendored

Binary file not shown.

View File

@@ -2,8 +2,8 @@
BROKER_LIST={{ log_kafkabrokers.address }} BROKER_LIST={{ log_kafkabrokers.address }}
[SYSTEM] [SYSTEM]
{% if tsg_running_type == 0 %} {% if tsg_running_type == 0 or 1 %}
NIC_NAME={{ tsg_tun_mode.ethname }} NIC_NAME={{ server.ethname }}
{% else %} {% else %}
NIC_NAME={{ nic_mgr.name }} NIC_NAME={{ nic_mgr.name }}
{% endif %} {% endif %}

View File

@@ -8,6 +8,7 @@
yum: yum:
name: "{{ fw_packages }}" name: "{{ fw_packages }}"
state: present state: present
skip_broken: yes
vars: vars:
fw_packages: fw_packages:
- /tmp/ansible_deploy/dns-2.0.2.5effe72-2.el7.x86_64.rpm - /tmp/ansible_deploy/dns-2.0.2.5effe72-2.el7.x86_64.rpm

View File

@@ -15,8 +15,8 @@ INC_CFG_DIR=capture_packet_rule/inc/index/
FULL_CFG_DIR=capture_packet_rule/full/index/ FULL_CFG_DIR=capture_packet_rule/full/index/
[LOG] [LOG]
{% if tsg_running_type == 0 %} {% if tsg_running_type == 0 or 1 %}
NIC_NAME={{ tsg_tun_mode.ethname }} NIC_NAME={{ server.ethname }}
{% else %} {% else %}
NIC_NAME={{ nic_mgr.name }} NIC_NAME={{ nic_mgr.name }}
{% endif %} {% endif %}

View File

@@ -24,8 +24,8 @@ IP_ADDR_TABLE=TSG_SECURITY_ADDR
[TSG_LOG] [TSG_LOG]
MODE=1 MODE=1
{% if tsg_running_type == 0 %} {% if tsg_running_type == 0 or 1 %}
NIC_NAME={{ tsg_tun_mode.ethname }} NIC_NAME={{ server.ethname }}
{% else %} {% else %}
NIC_NAME={{ nic_mgr.name }} NIC_NAME={{ nic_mgr.name }}
{% endif %} {% endif %}

Binary file not shown.

View File

@@ -4,11 +4,10 @@
dest: "/tmp/ansible_deploy/" dest: "/tmp/ansible_deploy/"
- name: "install framework packages" - name: "install framework packages"
# yum: yum:
# name: "{{ packages }}" name: "{{ packages }}"
# state: present state: present
# skip_broken: yes skip_broken: yes
shell: "rpm -ivh /tmp/ansible_deploy/{{ packages }}"
vars: vars:
packages: packages:
- /tmp/ansible_deploy/libMESA_field_stat-1.0.1.852c2df-1.el7.x86_64.rpm - /tmp/ansible_deploy/libMESA_field_stat-1.0.1.852c2df-1.el7.x86_64.rpm

View File

@@ -2,8 +2,8 @@
log_path = ./log/kni/kni.log log_path = ./log/kni/kni.log
log_level = {{ kni.global.log_level }} log_level = {{ kni.global.log_level }}
tfe_node_count = {{ kni.global.tfe_node_count }} tfe_node_count = {{ kni.global.tfe_node_count }}
{% if tsg_running_type == 0 %} {% if tsg_running_type == 0 or 1 %}
manage_eth = {{ tsg_tun_mode.ethname }} manage_eth = {{ server.ethname }}
{% else %} {% else %}
manage_eth = {{ nic_mgr.name }} manage_eth = {{ nic_mgr.name }}
{% endif %} {% endif %}
@@ -20,26 +20,26 @@ dst_mac_addr = fe:65:b7:03:50:bd
enabled = 1 enabled = 1
dev_eth_symbol = {{ nic_data_incoming.vf1_name }} dev_eth_symbol = {{ nic_data_incoming.vf1_name }}
ip_addr = 192.168.100.1 ip_addr = 192.168.100.1
{% elif tsg_running_type == 1 %} {% elif tsg_running_type == 2 %}
[tfe0] [tfe0]
enabled = 1 enabled = {{ kni.tfe_nodes.tfe0_enabled }}
dev_eth_symbol = {{ nic_to_tfe.tfe0.name }} dev_eth_symbol = {{ nic_to_tfe.tfe0.name }}
ip_addr = 192.168.100.2 ip_addr = 192.168.100.2
[tfe1] [tfe1]
enabled = 1 enabled = {{ kni.tfe_nodes.tfe1_enabled }}
dev_eth_symbol = {{ nic_to_tfe.tfe1.name }} dev_eth_symbol = {{ nic_to_tfe.tfe1.name }}
ip_addr = 192.168.100.3 ip_addr = 192.168.100.3
[tfe2] [tfe2]
enabled = 1 enabled = {{ kni.tfe_nodes.tfe2_enabled }}
dev_eth_symbol = {{ nic_to_tfe.tfe2.name }} dev_eth_symbol = {{ nic_to_tfe.tfe2.name }}
ip_addr = 192.168.100.4 ip_addr = 192.168.100.4
{% endif %} {% endif %}
[tfe_cmsg_receiver] [tfe_cmsg_receiver]
{% if tsg_running_type == 0 %} {% if tsg_running_type == 0 or 1%}
listen_eth = {{ tsg_tun_mode.tun_name }} listen_eth = {{ server.tun_name }}
{% else %} {% else %}
listen_eth = {{ nic_inner_ctrl.name }} listen_eth = {{ nic_inner_ctrl.name }}
{% endif %} {% endif %}
@@ -47,8 +47,8 @@ listen_port = 2475
[watch_dog] [watch_dog]
switch = {{ kni.watch_dog.switch }} switch = {{ kni.watch_dog.switch }}
{% if tsg_running_type == 0 %} {% if tsg_running_type == 0 or 1 %}
listen_eth = {{ tsg_tun_mode.tun_name }} listen_eth = {{ server.tun_name }}
{% else %} {% else %}
listen_eth = {{ nic_inner_ctrl.name }} listen_eth = {{ nic_inner_ctrl.name }}
{% endif %} {% endif %}

BIN
roles/mrzcpd/.DS_Store vendored

Binary file not shown.

View File

@@ -8,7 +8,7 @@ mtu=4096
clear_tx_flags=1 clear_tx_flags=1
vlan-filter=1 vlan-filter=1
vlan-strip=1 vlan-strip=1
vlan-id-allow={{ VlanFlipping.vlanID_1 }},{{ VlanFlipping.vlanID_2 }} vlan-id-allow={{ VlanFlipping.vlanID_1 }},{{ VlanFlipping.vlanID_2 }},{{ VlanFlipping.vlanID_3 }},{{ VlanFlipping.vlanID_4 }}
vlan-pvid=0 vlan-pvid=0
vlan-pvid-mode=2 vlan-pvid-mode=2
hw_strip_crc=1 hw_strip_crc=1

View File

@@ -8,6 +8,7 @@ nr_slots=1048576
expire_time=60 expire_time=60
reverse_tunnel=0 reverse_tunnel=0
use_recent_tunnel=0 use_recent_tunnel=0
use_link_info_table=1
use_tuple4_as_sskey=0 use_tuple4_as_sskey=0
ctrlzone_addr_info_type=2 ctrlzone_addr_info_type=2
@@ -16,4 +17,7 @@ enable=1
c_router_vlan_id_0={{ VlanFlipping.vlanID_1 }} c_router_vlan_id_0={{ VlanFlipping.vlanID_1 }}
i_router_vlan_id_0={{ VlanFlipping.vlanID_2 }} i_router_vlan_id_0={{ VlanFlipping.vlanID_2 }}
en_mac_flipping_0=0 en_mac_flipping_0=0
en_mac_flipping_0=0
c_router_vlan_id_1={{ VlanFlipping.vlanID_3 }}
i_router_vlan_id_1={{ VlanFlipping.vlanID_4 }}
en_mac_flipping_1=0

Binary file not shown.

View File

@@ -6,10 +6,7 @@
- name: "copy files" - name: "copy files"
copy: copy:
src: src: "{{ role_path }}/files/"
- "{{ role_path }}/files/proxy_start"
- "{{ role_path }}/files/proxy_status"
- "{{ role_path }}/files/proxy_stop"
dest: /opt/proxy_status dest: /opt/proxy_status
mode: 0755 mode: 0755

BIN
roles/sapp/.DS_Store vendored

Binary file not shown.

View File

@@ -14,6 +14,9 @@ worker_threads=1
{% else %} {% else %}
worker_threads={{ sapp.worker_threads }} worker_threads={{ sapp.worker_threads }}
{% endif %} {% endif %}
{% if tsg_access_type == 4 %}
send_only_threads_max={{ sapp.send_only_threads_max }}
{% endif %}
### note, bind_mask, if you do not want to bind thread to special CPU core, keep it empty as [] ### note, bind_mask, if you do not want to bind thread to special CPU core, keep it empty as []
{% if tsg_access_type == 0 %} {% if tsg_access_type == 0 %}
bind_mask=[] bind_mask=[]
@@ -22,6 +25,13 @@ bind_mask=[{{ sapp.bind_mask }}]
{% endif %} {% endif %}
[PACKET_IO] [PACKET_IO]
{% if tsg_access_type == 4 %}
### note, used to represent inbound or outbound direction value,
##### because it comes from other device, so it needs to be specified manually,
##### if inbound_route_dir=1, then outbound_route_dir=0, vice versa,
##### in other words, outbound_route_dir = 1 ^ inbound_route_dir;
inbound_route_dir={{ sapp.inbound_route_dir }}
{% endif %}
### note, BSD_packet_filter, if you do not want to set any filter rule, keep it empty as "" ### note, BSD_packet_filter, if you do not want to set any filter rule, keep it empty as ""
BSD_packet_filter="" BSD_packet_filter=""
@@ -37,7 +47,7 @@ BSD_packet_filter=""
[packet_io.internal.interface] [packet_io.internal.interface]
{% if tsg_access_type == 0 %} {% if tsg_access_type == 0 %}
type=pcap type=pcap
name={{tsg_tun_mode.internal_interface}} name={{server.internal_interface}}
{% else %} {% else %}
type=marsio type=marsio
name=vxlan_user name=vxlan_user
@@ -46,7 +56,7 @@ BSD_packet_filter=""
[packet_io.external.interface] [packet_io.external.interface]
{% if tsg_access_type == 0 %} {% if tsg_access_type == 0 %}
type=pcap type=pcap
name={{tsg_tun_mode.external_interface}} name={{server.external_interface}}
{% else %} {% else %}
type=pcap type=pcap
name=lo name=lo

View File

@@ -17,7 +17,7 @@
files = ["stdout", "/tmp/metrics.out"] files = ["stdout", "/tmp/metrics.out"]
data_format = "json" data_format = "json"
[[outputs.kafka]] [[outputs.kafka]]
brokers = ["{{ log_kafkabrokers.address }}"] brokers = ["192.168.40.186:9092"]
topic = "TRAFFIC-METRICS-LOG" topic = "TRAFFIC-METRICS-LOG"
data_format = "json" data_format = "json"
[[outputs.prometheus_client]] [[outputs.prometheus_client]]

View File

@@ -2,8 +2,8 @@
log_level=30 log_level=30
[log] [log]
{% if tsg_running_type == 0 %} {% if tsg_running_type == 0 or 1 %}
nic_name={{ tsg_tun_mode.ethname }} nic_name={{ server.ethname }}
{% else %} {% else %}
nic_name={{ nic_mgr.name }} nic_name={{ nic_mgr.name }}
{% endif %} {% endif %}

View File

@@ -14,7 +14,7 @@ TFE_PEER_MAC_DATA_INCOMING=aa:bb:cc:dd:ee:ff
TFE_LOCAL_IP_DATA_INCOMING=172.16.241.2 TFE_LOCAL_IP_DATA_INCOMING=172.16.241.2
TFE_PEER_IP_DATA_INCOMING=172.16.241.1 TFE_PEER_IP_DATA_INCOMING=172.16.241.1
{% if tsg_running_type == 0 %} {% if tsg_running_type == 0 or 1 %}
TFE_WATCHDOG_DEVICE={{ tsg_tun_mode.tun_name }} TFE_WATCHDOG_DEVICE={{ server.tun_name }}
TFE_WATCHDOG_IP=192.168.100.1 TFE_WATCHDOG_IP=192.168.100.1
{% endif %} {% endif %}

View File

@@ -31,8 +31,8 @@ service_cache_expire_seconds=600
# default 0 # default 0
mc_cache_enable=1 mc_cache_enable=1
# default eth0 # default eth0
{% if tsg_running_type == 0 %} {% if tsg_running_type == 0 or 1 %}
mc_cache_eth={{ tsg_tun_mode.tun_name }} mc_cache_eth={{ server.tun_name }}
{% else %} {% else %}
mc_cache_eth={{ nic_inner_ctrl.name }} mc_cache_eth={{ nic_inner_ctrl.name }}
{% endif %} {% endif %}
@@ -56,7 +56,7 @@ enable_health_check=0
passthrough_all_tcp=0 passthrough_all_tcp=0
[traffic_mirror] [traffic_mirror]
{% if tsg_running_type == 0 %} {% if tsg_running_type == 0 or 1 %}
device=lo device=lo
{% else %} {% else %}
device={{ nic_traffic_mirror.name }} device={{ nic_traffic_mirror.name }}

View File

@@ -1,25 +1,25 @@
#!/bin/bash #!/bin/bash
modprobe 8021q modprobe 8021q
vconfig add {{ tsg_tun_mode.ethname }} 100 vconfig add {{ server.ethname }} 100
vconfig set_flag {{ tsg_tun_mode.ethname }}.100 1 1 vconfig set_flag {{ server.ethname }}.100 1 1
ifconfig {{ tsg_tun_mode.ethname }}.100 192.168.100.1 netmask 255.255.255.0 up ifconfig {{ server.ethname }}.100 192.168.100.1 netmask 255.255.255.0 up
{% if tsg_access_type == 0 %} {% if tsg_access_type == 0 %}
ethtool -K {{ tsg_tun_mode.internal_interface }} tso off ethtool -K {{ server.internal_interface }} tso off
ethtool -K {{ tsg_tun_mode.internal_interface }} gso off ethtool -K {{ server.internal_interface }} gso off
ethtool -K {{ tsg_tun_mode.internal_interface }} gro off ethtool -K {{ server.internal_interface }} gro off
ethtool -K {{ tsg_tun_mode.external_interface }} tso off ethtool -K {{ server.external_interface }} tso off
ethtool -K {{ tsg_tun_mode.external_interface }} gso off ethtool -K {{ server.external_interface }} gso off
ethtool -K {{ tsg_tun_mode.external_interface }} gro off ethtool -K {{ server.external_interface }} gro off
{% elif tsg_access_type == 4 %} {% elif tsg_access_type == 4 %}
echo 3 > /sys/class/net/{{ nic_data_incoming.name }}/device/sriov_numvfs echo 3 > /sys/class/net/{{ nic_data_incoming.ethname }}/device/sriov_numvfs
ip link set {{ nic_data_incoming.name }} vf 1 vlan 4095 ip link set {{ nic_data_incoming.ethname }} vf 1 vlan 4095
ip link set {{ nic_data_incoming.name }} vf 2 vlan 4095 ip link set {{ nic_data_incoming.ethname }} vf 2 vlan 4095
ip link set {{ nic_data_incoming.name }} vf 0 trust on ip link set {{ nic_data_incoming.ethname }} vf 0 trust on
ip link set {{ nic_data_incoming.name }} vf 1 trust on ip link set {{ nic_data_incoming.ethname }} vf 1 trust on
ip link set {{ nic_data_incoming.name }} vf 2 trust on ip link set {{ nic_data_incoming.ethname }} vf 2 trust on
ip link set {{ nic_data_incoming.name }} vf 1 mac 00:0e:c6:d6:72:c1 ip link set {{ nic_data_incoming.ethname }} vf 1 mac 00:0e:c6:d6:72:c1
ip link set {{ nic_data_incoming.name }} vf 2 mac fe:65:b7:03:50:bd ip link set {{ nic_data_incoming.ethname }} vf 2 mac fe:65:b7:03:50:bd
ip link set {{ nic_data_incoming.name }} vf 0 spoofchk off ip link set {{ nic_data_incoming.ethname }} vf 0 spoofchk off
ip link set {{ nic_data_incoming.vf0_name }} up ip link set {{ nic_data_incoming.vf0_name }} up
ip link set {{ nic_data_incoming.vf1_name }} up ip link set {{ nic_data_incoming.vf1_name }} up
ip link set {{ nic_data_incoming.vf2_name }} up ip link set {{ nic_data_incoming.vf2_name }} up

View File

@@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash
# #
echo 0 >/sys/class/net/{{ tsg_tun_mode.ethname }}/device/sriov_numvfs echo 0 >/sys/class/net/{{ server.ethname }}/device/sriov_numvfs
ifconfig {{ tsg_tun_mode.ethname }}.100 down ifconfig {{ server.ethname }}.100 down
vconfig rem {{ tsg_tun_mode.ethname }}.100 vconfig rem {{ server.ethname }}.100
{% if tsg_access_type == 4 %} {% if tsg_access_type == 4 %}
echo 0 >/sys/class/net/{{ nic_data_incoming.name }}/device/sriov_numvfs echo 0 >/sys/class/net/{{ nic_data_incoming.ethname }}/device/sriov_numvfs
{% endif %} {% endif %}