Skip to content

Commit

Permalink
Merge pull request #45 from exsver/acl_ex
Browse files Browse the repository at this point in the history
update examples
  • Loading branch information
exsver authored Aug 6, 2024
2 parents 69dbbaa + 367503c commit e464900
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions comware/examples/ACL/RulesCreate/RulesCreate.go
Original file line number Diff line number Diff line change
@@ -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)
}
}

0 comments on commit e464900

Please sign in to comment.