ensoft/entrance/1.0.0

NOTE: the latest version is 1.0.5

EnTrance.Feature.Target.Config

Validating and commiting configuration changes via the CLI.

It takes a sequence of round-trip RPCs to actually get some configuration committed.

Load configuration into the target buffer

load : String -> Request

Enter some CLI-expressed configuration into the router's target buffer.

Config.load "router bgp 10 \n neighbor 1.2.3.4 \n remote-as 20"
    |> Channel.sendRpc { model | loadResult = Loading }
decodeLoad : (RpcData String -> msg) -> Decoder msg

Decode the reply from a load request. Takes a message constructor.

Commit or validate the target buffer config

Commit the configuration that was loaded via load.

Config.commit Commit
    |> Channel.sendRpc { model | commitResult = Loading }
= OnlyCheck
| Commit

Whether a commit should actually change the configuration, or merely validate.

decodeCommit : (RpcData String -> msg) -> Decoder msg

Decode the reply from a commit request. Takes a message constructor.

Get failures from a failed commit

Retrieve any failures from a commit (whether actually committed or merely validated).

Config.getFailures
    |> Channel.sendRpc { model | getFailuresResult = Loading }
decodeGetFailures : (RpcData String -> msg) -> Decoder msg

Decode the reply from a getFailures request. Takes a message constructor.

Get the config that could not be validated

Retrieve any configuration items which could not be validated.

Config.getUnvalidated
    |> Channel.sendRpc { model | getUnvalidatedResult = Loading }
decodeGetUnvalidated : (RpcData String -> msg) -> Decoder msg

Decode the reply from a getUnvalidated request. Takes a message constructor.

Starting and stopping

Start a config feature instance. This represents the option to configure one router. This is an async request - use the connection state notifications to track progress.

Stop a config feature instance. This is an async request.

decodeIsUp : (Bool -> msg) -> Decoder msg

Decode an up/down notification requested by passing SubscribeToConState to start. Takes a message constructor.

Parsing failures

The result of a getFailures request is just a blob of text (as provided by the router). You can parse this into a more structured form using the following function.

parseFailures : RpcData String -> List Failed

Parse the result of a getFailures request. If there is anything awkward about the inputs, just return the empty list.

type alias Failed =
{ config : String
, error : String
}

A line of configuration that has failed, and the error string that prevented the configuration commit from succeeding.