-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDiscovery_BAI.tpl
81 lines (62 loc) · 2.54 KB
/
Discovery_BAI.tpl
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
tpl 1.15 module Traversys_Discovery_BAI;
metadata
origin:= "Traversys";
_name:= "Discovery Deployment";
tree_path:= "Custom", "Traversys", "Discovery Deployment";
end metadata;
table opMode 1.0
"0" -> "Normal";
"1" -> "Record";
"2" -> "Playback";
default -> "Unknown";
end table;
pattern DiscoveryDeployment 1.0
"""
This models the Discovery Deployment.
Author: Traversys
Change History
--------------
1.0 : Created
"""
overview
tags traversys, discovery_deployment;
end overview;
constants
type := "Discovery Deployment";
description := "BMC Discovery solution deployed for Traversys.";
environment := "Test";
end constants;
triggers
on si := SoftwareInstance created, confirmed where type = "BMC Discovery";
end triggers;
body
host:= model.host(si);
version := si.product_version;
scan_mode := "Unknown";
options:= discovery.runCommand(host, "/usr/tideway/bin/tw_options --user system --passwordfile /usr/tideway/.pass");
if options and options.result then
scan_op_mode := regex.extract(options.result, regex "DISCOVERY_OPERATING_MODE\s+=\s+(\d)", raw "\1");
scan_mode := opMode[scan_op_mode];
log.debug("Scan mode for %si.name%: %scan_mode%");
end if;
name := "%type% %version% (%environment%)";
key := text.hash("%type%/%version%/%environment%");
bai := model.BusinessApplicationInstance(key := key,
type := type,
name := name,
environment := environment,
version := version,
product_version := version,
description := description,
scanning_mode := scan_mode,
_traversys:= true
);
log.info("Business Application Instance created: %bai.name%");
model.addDisplayAttribute(bai, [ "environment", "scanning_mode" ]);
model.addContainment(bai, si);
proxies := search(in si traverse Client:Communication:Server:SoftwareInstance);
for proxy in proxies do
model.addContainment(bai, proxy);
end for;
end body;
end pattern;