Orb GNMIC provison gnmic instances through a simple REST API using a policy mechanism. Each policy spin up a new gnmic process running the configuration provided by the policy.
1. Single binary: orb-gnmic embeds gnmic in its binary. Therefore, only one static binary is provided.
2. No persistence: orb-gnmic stores data in memory and in temporary files only. This adds a new paradigm to gnmic that is expected to run over a persisted config file as default.
3. Compatibility: orb-gnmic is basically a wrapper over the official gnmic which has not released a version 1.0 yet, i.e., breaking changes are expected. Any changes that occurs on its CLI will be reflected in this project.
You can download and run using docker image:
docker run --net=host ghcr.io/orb-community/orb-gnmic run
Orb GNMIC allows some start up configuration that is listed below.
docker run --net=host ghcr.io/orb-community/orb-gnmic run --help
Run orb-gnmic
Usage:
orb-gnmic run [flags]
Flags:
-d, --debug Enable verbose (debug level) output
-h, --help help for run
-a, --server_host string Define REST Host (default "localhost")
-p, --server_port uint Define REST Port (default 10337)The default orb-gnmic address is localhost:10222. to change that you can specify host and port when starting orb-gnimc:
docker run --net=host ghcr.io/orb-community/orb-gnmic run -a {host} -p {port}orb-gnmic is aimed to be simple and straightforward.
GET /api/v1/status (gets orb-gnmic runtime data)
None
http code content-type response 200application/json; charset=utf-8JSON data
curl -X GET -H "Content-Type: application/json" http://localhost:10337/api/v1/status
GET /api/v1/capabilities (gets otelcol-contrib capabilities)
None
http code content-type response 200application/json; charset=utf-8JSON data
curl -X GET -H "Content-Type: application/json" http://localhost:10337/api/v1/capabilities
GET /api/v1/policies (gets all existing policies)
None
http code content-type response 200application/json; charset=utf-8JSON array containing all applied policy names
curl -X GET -H "Content-Type: application/json" http://localhost:10337/api/v1/policies
POST /api/v1/policies (Creates a new policy)
name type data type description None required YAML object yaml format specified in Policy RFC
http code content-type response 201application/x-yaml; charset=UTF-8YAML object 400application/json; charset=UTF-8{ "message": "invalid Content-Type. Only 'application/x-yaml' is supported" }400application/json; charset=UTF-8Any policy error 400application/json; charset=UTF-8{ "message": "only single policy allowed per request" }403application/json; charset=UTF-8{ "message": "config field is required" }409application/json; charset=UTF-8{ "message": "policy already exists" }
curl -X POST -H "Content-Type: application/x-yaml" --data @post.yaml http://localhost:10337/api/v1/policies
GET /api/v1/policies/{policy_name} (gets information of a specific policy)
name type data type description policy_namerequired string The unique policy name
http code content-type response 200application/x-yaml; charset=UTF-8YAML object 404application/json; charset=UTF-8{ "message": "policy not found" }
curl -X GET http://localhost:10337/api/v1/policies/my_policy
DELETE /api/v1/policies/{policy_name} (delete a existing policy)
name type data type description policy_namerequired string The unique policy name
http code content-type response 200application/json; charset=UTF-8{ "message": "my_policy was deleted" }404application/json; charset=UTF-8{ "message": "policy not found" }
curl -X DELETE http://localhost:10337/api/v1/policies/my_policy
my_policy:
username: admin
password: admin
port: 57400
timeout: 10s
skip-verify: true
encoding: json_ietf
targets:
leaf1:57400:
leaf2:57400:
leaf3:57400:
spine1:57400:
spine2:57400:
subscriptions:
srl_if_oper_state:
paths:
- /interface[name=ethernet-1/*]/oper-state
mode: stream
stream-mode: sample
sample-interval: 5s
srl_net_instance:
paths:
- /network-instance[name=*]/oper-state
mode: stream
stream-mode: sample
sample-interval: 5s
srl_if_stats:
paths:
- /interface[name=ethernet-1/*]/statistics
mode: stream
stream-mode: sample
sample-interval: 5s
srl_if_traffic_rate:
paths:
- /interface[name=ethernet-1/*]/traffic-rate
mode: stream
stream-mode: sample
sample-interval: 5s
srl_cpu:
paths:
- /platform/control[slot=*]/cpu[index=all]/total
mode: stream
stream-mode: sample
sample-interval: 5s
srl_mem:
paths:
- /platform/control[slot=*]/memory
mode: stream
stream-mode: sample
sample-interval: 5s
srl_bgp_stats:
paths:
- /network-instance[name=*]/protocols/bgp/statistics
mode: stream
stream-mode: sample
sample-interval: 5s
srl_ipv4_routes:
paths:
- /network-instance[name=*]/route-table/ipv4-unicast/statistics/
mode: stream
stream-mode: sample
sample-interval: 5s
srl_ipv6_routes:
paths:
- /network-instance[name=*]/route-table/ipv6-unicast/statistics/
mode: stream
stream-mode: sample
sample-interval: 5s
srl_apps:
paths:
- /system/app-management/application[name=*]
mode: stream
stream-mode: sample
sample-interval: 5s
outputs:
prom:
type: prometheus
listen: :9273
path: /metrics
metric-prefix: gnmic
append-subscription-name: true
export-timestamps: true
debug: false
event-processors:
- trim-prefixes
- up-down-map
processors:
trim-prefixes:
event-strings:
value-names:
- ".*"
transforms:
- path-base:
apply-on: "name"
up-down-map:
event-strings:
value-names:
- oper-state
transforms:
- replace:
apply-on: "value"
old: "up"
new: "1"
- replace:
apply-on: "value"
old: "down"
new: "0"