Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
if: matrix.full-tests
run: | # TODO: use the GH action instead
curl -sL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh |
sh -s -- -b $HOME/go/bin v1.64.8
sh -s -- -b $HOME/go/bin v2.1.6
$HOME/go/bin/golangci-lint run --timeout=30m \
--max-issues-per-linter 0 \
--max-same-issues 0 \
Expand Down
9 changes: 6 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
run:
skip-dirs:
- pkg/mudyang # generated code
version: "2"
linters:
exclusions:
paths:
- mudyang.go # generated code
- cmd/ # code to be removed soon
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
# all YANG modules. The generator name will be overridden in the
# generated code using sed.
generate:
~/go/bin/go1.24.0 tool github.com/openconfig/ygot/generator -path=yang -output_file=pkg/mudyang/mudyang.go -generate_simple_unions -package_name=mudyang -generate_fakeroot -fakeroot_name=mudfile yang/ietf-packet-fields@2019-03-04.yang yang/ietf-ethertypes@2019-03-04.yang yang/ietf-acldns.yang yang/ietf-access-control-list@2019-03-04.yang yang/ietf-inet-types@2024-10-21.yang yang/iana-tls-profile@2025-04-18.yang yang/ietf-acl-tls@2025-04-18.yang yang/iana-hash-algs.yang yang/ietf-netconf-acm.yang yang/ietf-crypto-types@2021-09-14.yang yang/ietf-mud-transparency@2023-10-10.yang yang/ietf-ol@2024-04-26.yang yang/ietf-mud-tls@2025-04-18.yang yang/ietf-mud@2019-01-28.yang
sed '7s,.*,This package was generated by github.com\/openconfig\/ygot\/generator@v0.31.0,g' pkg/mudyang/mudyang.go > pkg/mudyang/mudyang.go.rewritten && mv pkg/mudyang/mudyang.go.rewritten pkg/mudyang/mudyang.go
@~/go/bin/go1.24.0 tool github.com/openconfig/ygot/generator -path=yang -output_file=mudyang.go -generate_simple_unions -package_name=mudyang -generate_fakeroot -fakeroot_name=mudfile yang/ietf-packet-fields@2019-03-04.yang yang/ietf-ethertypes@2019-03-04.yang yang/ietf-acldns.yang yang/ietf-access-control-list@2019-03-04.yang yang/ietf-inet-types@2024-10-21.yang yang/iana-tls-profile@2025-04-18.yang yang/ietf-acl-tls@2025-04-18.yang yang/iana-hash-algs.yang yang/ietf-netconf-acm.yang yang/ietf-crypto-types@2021-09-14.yang yang/ietf-mud-transparency@2023-10-10.yang yang/ietf-ol@2024-04-26.yang yang/ietf-mud-tls@2025-04-18.yang yang/ietf-mud@2019-01-28.yang
@sed '7s,.*,This package was generated by github.com\/openconfig\/ygot\/generator@v0.31.0,g' mudyang.go > mudyang.go.rewritten && mv mudyang.go.rewritten mudyang.go

.PHONY: generate
lint:
@golangci-lint run --config .golangci.yml

.PHONY: generate lint
5 changes: 2 additions & 3 deletions cmd/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import (
"fmt"
"os"

"github.com/spf13/cobra"

"github.com/openconfig/ygot/ygot"
"github.com/spf13/cobra"

"github.com/hslatman/mud.yang.go/pkg/mudyang"
"github.com/hslatman/go-mudyang"
)

var readCmd = &cobra.Command{
Expand Down
3 changes: 2 additions & 1 deletion cmd/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"fmt"
"os"

"github.com/hslatman/mud.yang.go/pkg/mudyang"
"github.com/openconfig/ygot/ytypes"
"github.com/spf13/cobra"

"github.com/hslatman/go-mudyang"
)

var validateCmd = &cobra.Command{
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/hslatman/mud.yang.go
module github.com/hslatman/go-mudyang

go 1.24

Expand Down
9 changes: 0 additions & 9 deletions main.go

This file was deleted.

File renamed without changes.
23 changes: 12 additions & 11 deletions pkg/mudyang/mudyang_test.go → mudyang_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/hslatman/mud.yang.go/pkg/mudyang"
"github.com/hslatman/go-mudyang"
)

func TestMudfile_ΛValidate(t *testing.T) {
func TestMudfileValidate(t *testing.T) {
t.Parallel()

leafRefOptions := &ytypes.LeafrefOptions{
IgnoreMissingData: false,
Log: true,
Expand All @@ -31,56 +32,56 @@ func TestMudfile_ΛValidate(t *testing.T) {
}{
{
name: "ok/amazon-echo",
filepath: "./../../examples/amazonEchoMud.json",
filepath: "./examples/amazonEchoMud.json",
args: args{
opts: []ygot.ValidationOption{leafRefOptions},
},
},
{
name: "ok/lightbulb-2000",
filepath: "./../../examples/lightbulb2000.json",
filepath: "./examples/lightbulb2000.json",
args: args{
opts: []ygot.ValidationOption{leafRefOptions},
},
},
{
name: "ok/wemo-switch",
filepath: "./../../examples/wemoswitchMud.json",
filepath: "./examples/wemoswitchMud.json",
args: args{
opts: []ygot.ValidationOption{leafRefOptions},
},
},
{
name: "ok/ol",
filepath: "./../../examples/ol/olExample.json",
filepath: "./examples/ol/olExample.json",
args: args{
opts: []ygot.ValidationOption{leafRefOptions},
},
},
{
name: "ok/transparency/mixed",
filepath: "./../../examples/transparency/mixedExample.json",
filepath: "./examples/transparency/mixedExample.json",
args: args{
opts: []ygot.ValidationOption{leafRefOptions},
},
},
{
name: "ok/transparency/complete",
filepath: "./../../examples/transparency/completeExample.json",
filepath: "./examples/transparency/completeExample.json",
args: args{
opts: []ygot.ValidationOption{leafRefOptions},
},
},
{
name: "ok/tls/example",
filepath: "./../../examples/tls/example.json",
filepath: "./examples/tls/example.json",
args: args{
opts: []ygot.ValidationOption{leafRefOptions},
},
},
{
name: "fail/amazon-echo",
filepath: "./../../examples/invalidAmazonEchoMud.json",
filepath: "./examples/invalidAmazonEchoMud.json",
args: args{
opts: []ygot.ValidationOption{leafRefOptions},
},
Expand Down Expand Up @@ -108,7 +109,7 @@ func TestMudfile_ΛValidate(t *testing.T) {

assert.NoError(t, err)

err = mud.ΛValidate(tc.args.opts...)
err = mud.Validate(tc.args.opts...)
if tc.wantValidationErr {
assert.Error(t, err)
return
Expand Down
Loading