-
Notifications
You must be signed in to change notification settings - Fork 0
/
fabric_netflow.py
executable file
·57 lines (50 loc) · 1.58 KB
/
fabric_netflow.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env python3
"""
Name: fabric_netflow.py
Description: Create a fabric with netflow configured
"""
from ndfc_python.log import log
from ndfc_python.ndfc import NDFC
from ndfc_python.ndfc_credentials import NdfcCredentials
from ndfc_python.ndfc_easy_fabric import NdfcEasyFabric
nc = NdfcCredentials()
logger = log("fabric_netflow_log", "INFO", "DEBUG")
ndfc = NDFC()
ndfc.username = nc.username
ndfc.password = nc.password
ndfc.ip4 = nc.ndfc_ip
ndfc.logger = logger
ndfc.login()
exporter_dict = {}
exporter_dict["EXPORTER_NAME"] = "exporter1"
exporter_dict["IP"] = "172.22.150.102"
exporter_dict["VRF"] = "default"
exporter_dict["SRC_IF_NAME"] = "Loopback0"
exporter_dict["UDP_PORT"] = 6500
exporter_list = []
exporter_list.append(exporter_dict)
record_dict = {}
record_dict["RECORD_NAME"] = "ipv4-record"
record_dict["RECORD_TEMPLATE"] = "netflow_ipv4_record"
record_dict["LAYER2_RECORD"] = False
record_list = []
record_list.append(record_dict)
monitor_dict = {}
monitor_dict["MONITOR_NAME"] = "netflow-monitor"
monitor_dict["RECORD_NAME"] = "ipv4-record"
monitor_dict["EXPORTER1"] = "exporter1"
monitor_list = []
monitor_list.append(monitor_dict)
instance = NdfcEasyFabric()
instance.ndfc = ndfc
instance.logger = logger
instance.fabric_name = "easy_netflow"
instance.bgp_as = 65001
instance.dci_subnet_range = "10.25.0.0/16"
instance.loopback0_ip_range = "10.26.0.0/16"
instance.loopback1_ip_range = "10.27.0.0/16"
instance.enable_netflow = True
instance.netflow_exporter_list = exporter_list
instance.netflow_record_list = record_list
instance.netflow_monitor_list = monitor_list
instance.create()