diff --git a/comware/examples/ACL/RulesCreate/RulesCreate.go b/comware/examples/ACL/RulesCreate/RulesCreate.go new file mode 100644 index 0000000..800fe5c --- /dev/null +++ b/comware/examples/ACL/RulesCreate/RulesCreate.go @@ -0,0 +1,35 @@ +package main + +import ( + "log" + + "github.com/exsver/netconf/comware" + "github.com/exsver/netconf/netconf" +) + +func main() { + // Setting the Log Level for netconf lib. + // One of: + // netconf.LogLevel.Silent() + // netconf.LogLevel.Default() - default + // netconf.LogLevel.Messages() + // netconf.LogLevel.Verbose() + netconf.LogLevel.Verbose() + + // Creating a new device. + sw, err := comware.NewTargetDevice("10.10.10.10", "netconf-user", "netconf-password") + if err != nil { + log.Fatalf("%s", err) + } + + // Preparing data. + rules := comware.IPv4NamedAdvanceRules{IPv4NamedAdvanceRules: []comware.IPv4NamedAdvanceRule{{ + GroupIndex: "testACL", + }}} + + // Configuring device. + err = sw.Configure(*rules.ConvertToTop(), "remove") + if err != nil { + log.Fatalf("%s", err) + } +}