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
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
test:
strategy:
matrix:
go-version: [1.20.x]
go-version: [1.24.x]
full-tests: [false]
include:
- go-version: 1.20.x
- go-version: 1.24.x
full-tests: true

runs-on: ubuntu-latest
Expand All @@ -22,17 +22,17 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.20.7' # TODO: fix matrix
go-version: '1.24.3' # TODO: fix matrix
cache: true

- name: Checkout code
uses: actions/checkout@v3

- name: Linting
if: matrix.full-tests
run: |
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.54.2
sh -s -- -b $HOME/go/bin v1.64.8
$HOME/go/bin/golangci-lint run --timeout=30m \
--max-issues-per-linter 0 \
--max-same-issues 0 \
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# generate calls the ygot generator to generate Go code from
# 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

.PHONY: generate
27 changes: 15 additions & 12 deletions cmd/generate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ var generateCmd = &cobra.Command{
excludeState := false
preferOperationalState := false

compressBehaviour, _ := genutil.TranslateToCompressBehaviour(compressPaths, excludeState, preferOperationalState)
compressBehaviour, err := genutil.TranslateToCompressBehaviour(compressPaths, excludeState, preferOperationalState)
if err != nil {
return err
}

cg := gogen.New(
"github.com/hslatman/mud.yang.go",
Expand Down Expand Up @@ -106,17 +109,17 @@ var generateCmd = &cobra.Command{
"yang/ietf-packet-fields@2019-03-04.yang", // TODO: we currently provide these as modules, but I think importing should be enough?
"yang/ietf-ethertypes@2019-03-04.yang",
"yang/ietf-acldns.yang",
"yang/ietf-inet-types.yang",
"yang/ietf-access-control-list.yang",
"yang/iana-tls-profile@2022-10-10.yang", // NOTE: sourced from https://yangcatalog.org/YANG-modules/iana-tls-profile%402022-10-10.yang
"yang/ietf-acl-tls@2022-10-10.yang", // NOTE: sourced from https://yangcatalog.org/YANG-modules/ietf-acl-tls%402022-10-10.yang
"yang/iana-hash-algs.yang", // NOTE: sourced from https://raw.githubusercontent.com/YangModels/yang/3af23949e11a2acd2f36df1dc0afca73ffe118ac/experimental/ietf-extracted-YANG-modules/iana-hash-algs@2020-03-08.yang
"yang/ietf-netconf-acm.yang", // NOTE: sourced from https://raw.githubusercontent.com/huawei/yang/855d2d384d49fea03872e75fcea4d40619cf3528/network-router/8.20.0/atn980b/ietf-netconf-acm.yang
"yang/ietf-crypto-types@2021-09-14.yang", // NOTE: sourced from https://yangcatalog.org/YANG-modules/
"yang/ietf-mud-transparency@2021-10-22.yang", // NOTE: currently sourced from https://github.com/elear/mud-sbom/commit/e8a1280a15f742c333f6222068df69c99f328de2
"yang/ietf-ol@2021-05-21.yang", // NOTE: sourced from https://yangcatalog.org/YANG-modules/
"yang/ietf-mud-tls@2022-10-10.yang", // NOTE: sourced from https://yangcatalog.org/YANG-modules/ietf-mud-tls%402022-10-10.yang
"yang/ietf-mud@2019-01-28.yang",
"yang/ietf-access-control-list@2019-03-04.yang", // NOTE sourced from https://www.yangcatalog.org/all_modules/ietf-access-control-list@2019-03-04.yang
"yang/ietf-inet-types@2024-10-21.yang", // NOTE: sourced from https://www.yangcatalog.org/all_modules/ietf-inet-types@2024-10-21.yang
"yang/iana-tls-profile@2025-04-18.yang", // NOTE: sourced from https://www.yangcatalog.org/all_modules/iana-tls-profile@2025-04-18.yang
"yang/ietf-acl-tls@2025-04-18.yang", // NOTE: sourced from https://www.yangcatalog.org/all_modules/ietf-acl-tls@2025-04-18.yang
"yang/iana-hash-algs.yang", // NOTE: sourced from https://raw.githubusercontent.com/YangModels/yang/3af23949e11a2acd2f36df1dc0afca73ffe118ac/experimental/ietf-extracted-YANG-modules/iana-hash-algs@2020-03-08.yang
"yang/ietf-netconf-acm.yang", // NOTE: sourced from https://raw.githubusercontent.com/huawei/yang/855d2d384d49fea03872e75fcea4d40619cf3528/network-router/8.20.0/atn980b/ietf-netconf-acm.yang
"yang/ietf-crypto-types@2021-09-14.yang", // NOTE: sourced from https://yangcatalog.org/YANG-modules/
"yang/ietf-mud-transparency@2023-10-10.yang", // NOTE: sourced from https://www.yangcatalog.org/all_modules/ietf-mud-transparency@2023-10-10.yang
"yang/ietf-ol@2024-04-26.yang", // NOTE: sourced from https://www.yangcatalog.org/all_modules/ietf-ol@2024-04-26.yang
"yang/ietf-mud-tls@2025-04-18.yang", // NOTE: sourced from https://www.yangcatalog.org/all_modules/ietf-mud-tls@2025-04-18.yang
"yang/ietf-mud@2019-01-28.yang", // NOTE: sourced from https://www.yangcatalog.org/all_modules/ietf-mud@2019-01-28.yang
}

generatedGoCode, errs := cg.Generate(generateModules, includePaths)
Expand Down
2 changes: 1 addition & 1 deletion examples/amazonEchoMud.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
}
}
},
"ietf-access-control-list:acls" : {
"ietf-access-control-list:acls": {
"acl" : [ {
"name" : "from-ipv4-amazonecho",
"type" : "ipv4-acl-type",
Expand Down
28 changes: 28 additions & 0 deletions examples/ol/olExample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"ietf-mud:mud": {
"mud-version": 1,
"extensions": [
"ol"
],
"ietf-ol:ol": {
"license": [
{
"owner-name": "Copyright 2024 Frobinator, Inc",
"spdx-tags": [
"0BSD"
]
}
]
},
"mud-url": "https://frobs.example.com/mud/Frob.json",
"mud-signature": "https://frobs.example.com/mud/Frob.p7s",
"last-update": "2021-05-24T11:26:04+00:00",
"cache-validity": 48,
"is-supported": true,
"systeminfo": "This device helps produce frobs",
"mfg-name": "FrobMaster",
"documentation": "https://frobs.example.com/doc",
"model-name": "Frobinator"
}
}

86 changes: 0 additions & 86 deletions examples/sbom/completeExample.json

This file was deleted.

28 changes: 0 additions & 28 deletions examples/sbom/mixedExample.json

This file was deleted.

12 changes: 3 additions & 9 deletions examples/tls/example.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"ietf-mud:mud": {
"mud-version": 1,
"mud-url": "https://example.com/IoTDevice",
"last-update": "2019-18-06T03:56:40.105+10:00",
"last-update": "2024-08-05T03:56:40.105+10:00",
"cache-validity": 100,
"extensions": [
"ietf-mud-tls"
Expand Down Expand Up @@ -48,14 +48,8 @@
"tls13"
],
"cipher-suite": [
{
"cipher": 19,
"hash": 1
},
{
"cipher": 19,
"hash": 2
}
4865,
4866
],
"extension-type": [
10,
Expand Down
83 changes: 83 additions & 0 deletions examples/transparency/completeExample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"ietf-mud:mud": {
"mud-version": 1,
"extensions": [
"transparency"
],
"mudtx:transparency": {
"sbom-local-well-known": "https",
"vuln-url": [
"https://iotd.example.com/info/modelX/csaf.json"
]
},
"mud-url": "https://iot.example.com/modelX.json",
"mud-signature": "https://iot.example.com/modelX.p7s",
"last-update": "2022-01-05T13:30:31+00:00",
"cache-validity": 48,
"is-supported": true,
"systeminfo": "retrieving vuln and SBOM info via a cloud service",
"mfg-name": "Example, Inc.",
"documentation": "https://iot.example.com/doc/modelX",
"model-name": "modelX",
"from-device-policy": {
"access-lists": {
"access-list": [
{
"name": "mud-65443-v4fr"
}
]
}
},
"to-device-policy": {
"access-lists": {
"access-list": [
{
"name": "mud-65443-v4to"
}
]
}
}
},
"ietf-access-control-list:acls": {
"acl": [
{
"name": "mud-65443-v4to",
"type": "ipv4-acl-type",
"aces": {
"ace": [
{
"name": "cl0-todev",
"matches": {
"ipv4": {
"ietf-acldns:src-dnsname": "iotserver.example.com"
}
},
"actions": {
"forwarding": "accept"
}
}
]
}
},
{
"name": "mud-65443-v4fr",
"type": "ipv4-acl-type",
"aces": {
"ace": [
{
"name": "cl0-frdev",
"matches": {
"ipv4": {
"ietf-acldns:dst-dnsname": "iotserver.example.com"
}
},
"actions": {
"forwarding": "accept"
}
}
]
}
}
]
}
}
28 changes: 28 additions & 0 deletions examples/transparency/mixedExample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"ietf-mud:mud": {
"mud-version": 1,
"extensions": [
"transparency"
],
"mudtx:transparency": {
"sboms": [
{
"version-info": "1.2",
"sbom-url": "https://iot.example.com/info/modelX/sbom.json"
}
],
"vuln-url": [
"https://iotd.example.com/info/modelX/csaf.json"
]
},
"mud-url": "https://iot.example.com/modelX.json",
"mud-signature": "https://iot.example.com/modelX.p7s",
"last-update": "2022-01-05T13:29:12+00:00",
"cache-validity": 48,
"is-supported": true,
"systeminfo": "retrieving vuln and SBOM info via a cloud service",
"mfg-name": "Example, Inc.",
"documentation": "https://iot.example.com/doc/modelX",
"model-name": "modelX"
}
}
Loading
Loading