-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcommands.go
168 lines (160 loc) · 3.72 KB
/
commands.go
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
package main
import "github.com/urfave/cli/v2"
var commands = []*cli.Command{
commandCommand,
commandTinet,
commandClab,
commandParams,
commandVisual,
commandData,
}
var commandCommand = &cli.Command{
Name: "command",
Usage: "Build per-device configurations (commands) to a directory",
Action: CmdCommand,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "config",
Aliases: []string{"c"},
Usage: "Specify the Config file.",
Value: "config.yaml",
},
&cli.StringFlag{
Name: "dir",
Aliases: []string{"d"},
Usage: "Specify name of directory for per-device configuration.",
Value: "commands",
},
&cli.StringFlag{
Name: "profile",
Aliases: []string{"p"},
Usage: "Profile CPU performance in generating internal config model and output to the specified file.",
Value: "",
},
&cli.BoolFlag{
Name: "verbose",
Aliases: []string{"v"},
Usage: "Verbose",
},
},
}
var commandTinet = &cli.Command{
Name: "tinet",
Usage: "Build TiNet specification file from DOT file specified in arguments",
Action: CmdTinet,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "config",
Aliases: []string{"c"},
Usage: "Specify the Config file.",
Value: "config.yaml",
},
&cli.StringFlag{
Name: "output",
Aliases: []string{"o"},
Usage: "Specify name of output specification file.",
Value: "",
},
&cli.StringFlag{
Name: "profile",
Aliases: []string{"p"},
Usage: "Profile CPU performance in generating internal config model and output to the specified file.",
Value: "",
},
&cli.BoolFlag{
Name: "verbose",
Aliases: []string{"v"},
Usage: "Verbose",
},
},
}
var commandClab = &cli.Command{
Name: "clab",
Usage: "Build Containerlab topology file from DOT file",
Action: CmdClab,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "config",
Aliases: []string{"c"},
Usage: "Specify the Config file.",
Value: "config.yaml",
},
&cli.StringFlag{
Name: "output",
Aliases: []string{"o"},
Usage: "Specify name of output topology file.",
Value: "",
},
&cli.StringFlag{
Name: "profile",
Aliases: []string{"p"},
Usage: "Profile CPU performance in generating internal config model and output to the specified file.",
Value: "",
},
&cli.BoolFlag{
Name: "verbose",
Aliases: []string{"v"},
Usage: "Verbose",
},
},
}
var commandParams = &cli.Command{
Name: "params",
Usage: "List available numbers for config templates",
Action: CmdParams,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "config",
Aliases: []string{"c"},
Usage: "Specify the Config file.",
Value: "config.yaml",
},
&cli.BoolFlag{
Name: "all",
Aliases: []string{"a"},
Usage: "Show all numbers including relative ones.",
},
&cli.BoolFlag{
Name: "verbose",
Aliases: []string{"v"},
Usage: "Verbose",
},
},
}
var commandVisual = &cli.Command{
Name: "visual",
Usage: "Visualize IP address assignment in DOT file",
Action: CmdVisual,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "config",
Aliases: []string{"c"},
Usage: "Specify the Config file.",
Value: "config.yaml",
},
&cli.StringFlag{
Name: "layer",
Aliases: []string{"l"},
Usage: "Specify layer name to visualize. If not given, all information will be visualized.",
Value: "",
},
&cli.BoolFlag{
Name: "verbose",
Aliases: []string{"v"},
Usage: "Verbose",
},
},
}
var commandData = &cli.Command{
Name: "data",
Usage: "Output parameter data in JSON format",
Action: CmdData,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "config",
Aliases: []string{"c"},
Usage: "Specify the Config file.",
Value: "config.yaml",
},
},
}