Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse inspected console item definition #212

Conversation

maksym-nazarenko
Copy link
Collaborator

@maksym-nazarenko maksym-nazarenko commented Nov 13, 2023

This PR allows to generate MikroTik resource with list of all fields, which are available in RouterOS.
Detailed description is available in README.

Example of generated dhcp-server resource.

$ go run cmd/mikrotik-codegen/main.go mikrotik -commandBase /ip/dhcp-server -name DhcpServer -inspect-definition-file ./inspect_definition.txt

or fully automated way of querying remote system for the fields list:

$ go run cmd/mikrotik-codegen/main.go mikrotik -commandBase /ip/dhcp-server -name DhcpServer -query-definition
show output
type DhcpServer struct {
        Id                   string `mikrotik:".id"`
        AddArp               string `mikrotik:"add-arp"`
        AddressPool          string `mikrotik:"address-pool"`
        AllowDualStackQueue  string `mikrotik:"allow-dual-stack-queue"`
        AlwaysBroadcast      string `mikrotik:"always-broadcast"`
        Authoritative        string `mikrotik:"authoritative"`
        BootpLeaseTime       string `mikrotik:"bootp-lease-time"`
        BootpSupport         string `mikrotik:"bootp-support"`
        ClientMacLimit       string `mikrotik:"client-mac-limit"`
        Comment              string `mikrotik:"comment"`
        ConflictDetection    string `mikrotik:"conflict-detection"`
        CopyFrom             string `mikrotik:"copy-from"`
        DelayThreshold       string `mikrotik:"delay-threshold"`
        DhcpOptionSet        string `mikrotik:"dhcp-option-set"`
        Disabled             string `mikrotik:"disabled"`
        InsertQueueBefore    string `mikrotik:"insert-queue-before"`
        Interface            string `mikrotik:"interface"`
        LeaseScript          string `mikrotik:"lease-script"`
        LeaseTime            string `mikrotik:"lease-time"`
        Name                 string `mikrotik:"name"`
        ParentQueue          string `mikrotik:"parent-queue"`
        Relay                string `mikrotik:"relay"`
        ServerAddress        string `mikrotik:"server-address"`
        UseFramedAsClassless string `mikrotik:"use-framed-as-classless"`
        UseRadius            string `mikrotik:"use-radius"`
}

@ddelnano
Copy link
Owner

ddelnano commented Feb 9, 2024

Sorry for the extremely late review on this. Very exciting to see the code generation pieces coming together!

@maksym-nazarenko maksym-nazarenko merged commit 326ca07 into ddelnano:master Feb 9, 2024
4 checks passed
@maksym-nazarenko maksym-nazarenko deleted the codegen/parse-inspected-console-item-definition branch February 9, 2024 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants