From 367503c69ea53534089bb0535c829846f6e4216d Mon Sep 17 00:00:00 2001 From: exsver Date: Tue, 6 Aug 2024 18:16:14 +0300 Subject: [PATCH] update examples --- .../examples/ACL/RulesCreate/RulesCreate.go | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 comware/examples/ACL/RulesCreate/RulesCreate.go 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) + } +}