@@ -28,8 +28,7 @@ def test_data_extraction(self):
28
28
"TCP-MIB" : {
29
29
"additionalVarBinds" : [
30
30
{
31
- "regex" : "([0-9]+_[0-9]+_[0-9]+_[0-9]+)_([0-9]+)_([0-9]+_[0-9]+_[0-9]+_[0-9]+)_([0-9]+)" , # noqa: E501
32
- "names" : "IP_one/port/IP_two/index_number" ,
31
+ "regex" : "(?P<IP_one>[0-9]+_[0-9]+_[0-9]+_[0-9]+)_(?P<port>[0-9]+)_(?P<IP_two>[0-9]+_[0-9]+_[0-9]+_[0-9]+)_(?P<index_number>[0-9]+)" , # noqa: E501
33
32
}
34
33
]
35
34
},
@@ -38,13 +37,11 @@ def test_data_extraction(self):
38
37
{"ifDescr" : "interface_desc" },
39
38
{"ifPhysAddress" : "MAC_address" },
40
39
],
41
- "additionalVarBinds" : [{"indexNum" : "index_number" }],
42
40
},
43
41
"UDP-MIB" : {
44
42
"additionalVarBinds" : [
45
43
{
46
- "regex" : '(ipv4)_"([0-9]+_[0-9]+_[0-9]+_[0-9]+)"_([0-9]+)_(ipv4)_"([0-9]+_[0-9]+_[0-9]+_[0-9]+)"_([0-9]+)_([0-9]+)' , # noqa: E501
47
- "names" : "protocol_version_one/IP_one/port_one/protocol_version_two/IP_two/index_number/port_two" , # noqa: E501
44
+ "regex" : '(?P<protocol_version_one>ipv4)_"(?P<IP_one>[0-9]+_[0-9]+_[0-9]+_[0-9]+)"_(?P<port_one>[0-9]+)_(?P<protocol_version_two>ipv4)_"(?P<IP_two>[0-9]+_[0-9]+_[0-9]+_[0-9]+)"_(?P<index_number>[0-9]+)_(?P<port_two>[0-9]+)' , # noqa: E501
48
45
}
49
46
]
50
47
},
@@ -55,7 +52,7 @@ def test_data_extraction(self):
55
52
fields = {
56
53
"metric_name:sc4snmp.TCP-MIB.tcpConnLocalPort_192_168_0_1_161_127_0_0_1_5" : "1111"
57
54
}
58
- fields2 = {"metric_name:sc4snmp.IF-MIB.ifInErrors_2 " : "173127" }
55
+ fields2 = {"metric_name:sc4snmp.IF-MIB.ifInErrors_2_1_asdad_23 " : "173127" }
59
56
fields3 = {
60
57
'metric_name:sc4snmp.UDP-MIB.udpEndpointProcess_ipv4_"0_0_0_0"_111_ipv4_"0_0_0_0"_0_13348' : "123"
61
58
}
@@ -68,7 +65,7 @@ def test_data_extraction(self):
68
65
)
69
66
70
67
extract_additional_properties (
71
- fields2 , "sc4snmp.IF-MIB.ifInErrors_2 " , "173127" , server_config
68
+ fields2 , "sc4snmp.IF-MIB.ifInErrors_2_1_asdad_23 " , "173127" , server_config
72
69
)
73
70
74
71
extract_additional_properties (
@@ -78,15 +75,17 @@ def test_data_extraction(self):
78
75
server_config ,
79
76
)
80
77
81
- self .assertEqual (fields ["IP_one" ], "192_168_0_1 " )
78
+ self .assertEqual (fields ["IP_one" ], "192.168.0.1 " )
82
79
self .assertEqual (fields ["port" ], "161" )
83
- self .assertEqual (fields ["IP_two" ], "127_0_0_1 " )
80
+ self .assertEqual (fields ["IP_two" ], "127.0.0.1 " )
84
81
self .assertEqual (fields ["index_number" ], "5" )
85
82
83
+ self .assertEqual (fields2 ["index_number" ], "23" )
84
+
86
85
self .assertEqual (fields3 ["protocol_version_one" ], "ipv4" )
87
- self .assertEqual (fields3 ["IP_one" ], "0_0_0_0 " )
86
+ self .assertEqual (fields3 ["IP_one" ], "0.0.0.0 " )
88
87
self .assertEqual (fields3 ["port_one" ], "111" )
89
88
self .assertEqual (fields3 ["protocol_version_two" ], "ipv4" )
90
- self .assertEqual (fields3 ["IP_two" ], "0_0_0_0 " )
89
+ self .assertEqual (fields3 ["IP_two" ], "0.0.0.0 " )
91
90
self .assertEqual (fields3 ["index_number" ], "0" )
92
91
self .assertEqual (fields3 ["port_two" ], "13348" )
0 commit comments