go-dnc

command module
v0.0.0-...-c02b23a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2020 License: MIT Imports: 5 Imported by: 0

README

GoDNC (Go´s distributed network client)

events

nats, event is sent through a nats cluster. the pollers and dispatchers connect to queues.

NET

telnet and snmpc packages are move out from this repo. they are not created for just this and can be used for much more. maybe the telnet library should be made public.

CMD

agentd

Should start a agentd worker that polls/commands the network.

dispatchd

should start a disptacher that sends work through NATS to the agents.

api

the api connects to the dispatchers and commands them. Sothbound API is rest Northbond API with gRPC

transport

all messages is sent and received as protobuf

structure

agent (poller/commander)

listen to queues and dispatches work depending on it. sends response back to the queue for a writer to save the data.

snmp
  • walk
  • bulkwalk
  • get
  • bulkget
  • cache connections (one connection to one host. )
  • data and send the result
  • announce connectivity to the cluster
telnet
  • login
  • send command
  • read output
  • cache connections (one connection to one host. )
  • announce connectivity to the cluster
dispatcher

recieves work from the api end dispatches it to a queue. Listens to responses on that queue. the response is parsed and data is stored in backend database.

writer

picks up

configuration

configuratio is done with the viper pkg viper connects to etcd for a global config-store for all moving parts.

the agent/dispatcher fetches configuration from etcd. cache could be enabled later `elements/$vendor/$modell´

storage

mysql / mongodb / elastic.

purpose & goal

To be able to provision a network element Lock element from being touched by other commands that may interfere Send a command to the element Parse response & return response Unlock the element

To be able to gather information about a network element - send one command - send several commands - snmp / telnet / ...

Local development with Docker

Docker Swarm is used in order to orchestrate multiple instances of DNCs so that they can be connected to the NATS cluster easily. Below are some instructions on how to create multiple instances locally and to connect them to the local NATS cluster.

  1. Firstly, it is necessary to make sure that the host IP address is set correctly in poller.yml and dispatcher.yml in the nats_servers list.

  2. Initialize Docker Swarm, and create poller and dispatcher services with docker-compose:

    docker swarm init

  3. Build dispatcher and poller images with docker-compose. Push the images to global registry.

    docker-compose build - if the images run successfully, ctrl-c and move on to the next command:

    docker-compose push

  4. deploy stack:

    docker stack deploy --compose-file docker-compose.yml go-dnc

  5. Scale deployed services using Docker Swarm (3 pollers and 2 dispatchers in this case):

    docker service scale go-dnc_poller=3 && docker service scale go-dnc_dispatcher=2

  6. Check that the services (and their replicas) are running:

    docker ps

    Expected output should be similar to this:

    CONTAINER ID        IMAGE                                COMMAND                  CREATED             STATUS              PORTS                                         NAMES
    a1924a75f546        registry.opentelco.io/go-dnc:latest   "/app/go-dnc dispatc…"   28 seconds ago      Up 26 seconds                                                     go-dnc-stack_dispatcher.2.g26463111a9m07syi9y64e5iu
    c3780a972013        registry.opentelco.io/go-dnc:latest   "/app/go-dnc poller …"   35 seconds ago      Up 32 seconds                                                     go-dnc-stack_poller.2.fs8wcv5339krb8dwl4dgf5oqx
    b8984091eedd        registry.opentelco.io/go-dnc:latest   "/app/go-dnc poller …"   35 seconds ago      Up 32 seconds                                                     go-dnc-stack_poller.3.j7h9mos5pf4mcnfs1cvhycm25
    258ef7fcb339        registry.opentelco.io/go-dnc:latest   "/app/go-dnc dispatc…"   41 seconds ago      Up 37 seconds                                                     go-dnc-stack_dispatcher.1.04do1i52wmihja1vyy5vuc2hi
    7871f6e22792        registry.opentelco.io/go-dnc:latest   "/app/go-dnc poller …"   41 seconds ago      Up 38 seconds                                                     go-dnc-stack_poller.1.bjktgz7a0jwrw3fxzdg6549vi
    

Stopping all instances can be done using docker swarm leave --force.

Additional references: https://docs.docker.com/engine/swarm/stack-deploy/

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL