tmsh

package module
v0.0.0-...-86757d7 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2018 License: MIT Imports: 8 Imported by: 0

README

go-tmsh

Build Status license

go-tmsh is a library providing functions to operate the BIG-IP Traffic Management Shell (TMSH) via SSH.

go-tmsh is also a command-line tool that will operate TMSH using these functions.

Tested versions of BIG-IP

Currently the following versions of BIG-IP are tested.

  • v11.5.3
  • v11.2.1

Install

$ go get github.com/shiftky/go-tmsh/...

Usage

Using the go-tmsh library
import "github.com/shiftky/go-tmsh"

Please refer to the examples directory for an example source code.

Using the tmsh command line tool

tmsh is single command-line application. This application then takes subcommands. To check the all available commands,

$ tmsh help

To get help for any specific subcommand, run it with the -h flag,

$ tmsh node -h

Licence

MIT

Documentation

Index

Constants

View Source
const EOF = 57347
View Source
const IDENT = 57352
View Source
const ILLEGAL = 57346
View Source
const LTM = 57353
View Source
const L_BRACE = 57350
View Source
const NEWLINE = 57349
View Source
const R_BRACE = 57351
View Source
const WS = 57348

Variables

This section is empty.

Functions

func Unmarshal

func Unmarshal(data string, out interface{}) error

Unmarshal parses the 'field-fmt' formatted data and stores the result in the value pointed to by out.

Types

type BigIP

type BigIP struct {
	// contains filtered or unexported fields
}

BigIP is a struct for session state

func GenSession

func GenSession(host, port, user, password string, key []byte) (*BigIP, error)

GenSession handles either Password or SSH Key based..

func NewKeySession

func NewKeySession(host, port, user string, key []byte) (*BigIP, error)

NewKeySession is NewSession plus key handling

func NewSession

func NewSession(host, port, user, password string) (*BigIP, error)

NewSession sets up new SSH session to BIG-IP TMSH

func (*BigIP) AddMonitorToPool

func (bigip *BigIP) AddMonitorToPool(poolName, monitorName string) error

DeletePoolMember adds a monitor to pool.

func (*BigIP) AddPoolMember

func (bigip *BigIP) AddPoolMember(poolName, nodeName, monitorName string, port int) error

DeletePoolMember adds a new pool member.

func (*BigIP) AddSecurityFWPolicyRule

func (bigip *BigIP) AddSecurityFWPolicyRule(firewallPolicyName, ruleName, action string, targetPort int) error

func (*BigIP) AddVirtualServerProfile

func (bigip *BigIP) AddVirtualServerProfile(vsName, profileName, context string) error

AddVirtualServerProfile adds a profile to a virtual server.

func (*BigIP) ApplyPolicyToVirtualServer

func (bigip *BigIP) ApplyPolicyToVirtualServer(vsName, policyName string) error

ApplyPolicyToVirtualServer applies a policy to a virtual server.

func (*BigIP) Close

func (bigip *BigIP) Close()

Close is used to close SSH session

func (*BigIP) CreateNode

func (bigip *BigIP) CreateNode(name, ipaddr string) error

CreateNode creates a new node.

func (*BigIP) CreatePool

func (bigip *BigIP) CreatePool(name string) error

CreatePool creates a new pool.

func (*BigIP) CreateSecurityFWPolicy

func (bigip *BigIP) CreateSecurityFWPolicy(firewallPolicyName string) error

func (*BigIP) CreateVirtualServer

func (bigip *BigIP) CreateVirtualServer(vsName, poolName, targetVIP, defaultProfileName string, targetPort int) error

CreateVirtualServer creates a virtual server.

func (*BigIP) DeleteNode

func (bigip *BigIP) DeleteNode(name string) error

DeleteNode removes a node.

func (*BigIP) DeletePool

func (bigip *BigIP) DeletePool(name string) error

DeletePool removes a pool.

func (*BigIP) DeletePoolMember

func (bigip *BigIP) DeletePoolMember(poolName, nodeName string, port int) error

DeletePoolMember removes a pool member.

func (*BigIP) DeleteVirtualServer

func (bigip *BigIP) DeleteVirtualServer(vsName string) error

DeleteVirtualServer removes a virtual server.

func (*BigIP) DeleteVirtualServerProfile

func (bigip *BigIP) DeleteVirtualServerProfile(vsName, profileName, context string) error

DeleteVirtualServerProfile removes a profile from a virtual server.

func (*BigIP) DisableNode

func (bigip *BigIP) DisableNode(name string) error

DisableNode changes the status of a node to disable.

func (*BigIP) DisablePoolMember

func (bigip *BigIP) DisablePoolMember(poolName, nodeName string, port int) error

DisablePoolMember changes the status of pool member to disable.

func (*BigIP) EnableNode

func (bigip *BigIP) EnableNode(name string) error

EnableNode changes the status of a node to enable.

func (*BigIP) EnablePoolMember

func (bigip *BigIP) EnablePoolMember(poolName, nodeName string, port int) error

EnablePoolMember changes the status of pool member to enable.

func (*BigIP) ExecuteCommand

func (bigip *BigIP) ExecuteCommand(cmd string) (string, error)

ExecuteCommand is used to execute any TMSH commands

func (*BigIP) GetAllNodes

func (bigip *BigIP) GetAllNodes() ([]Node, error)

GetAllNodes returns a list of all nodes.

func (*BigIP) GetAllPools

func (bigip *BigIP) GetAllPools() ([]Pool, error)

GetAllPools returns a list of all pools

func (*BigIP) GetAllVirtualServers

func (bigip *BigIP) GetAllVirtualServers() ([]VirtualServer, error)

GetAllVirtualServers returns a list of all virtual servers

func (*BigIP) GetNode

func (bigip *BigIP) GetNode(name string) (*Node, error)

GetNode gets a node by name. Return nil if the node does not exist.

func (*BigIP) GetPool

func (bigip *BigIP) GetPool(name string) (*Pool, error)

GetPool gets a pool by name. Return nil if the pool does not exist.

func (*BigIP) GetVirtualServer

func (bigip *BigIP) GetVirtualServer(name string) (*VirtualServer, error)

GetVirtualServer gets a virtual server by name. Rerutn nil if the virtual server does not found.

func (*BigIP) RouteAdvertisementEnabled

func (bigip *BigIP) RouteAdvertisementEnabled(targetVIP string) error

func (*BigIP) Save

func (bigip *BigIP) Save() error

Save is used to execute 'save /sys config' command

type Lexer

type Lexer struct {
	// contains filtered or unexported fields
}

func (*Lexer) Error

func (l *Lexer) Error(e string)

func (*Lexer) Lex

func (l *Lexer) Lex(lval *yySymType) int

type Node

type Node struct {
	Name          string `ltm:"name"`
	Addr          string `ltm:"addr"`
	MonitorRule   string `ltm:"monitor-rule"`
	MonitorStatus string `ltm:"monitor-status"`
	EnabledState  string `ltm:"status.enabled-state"`
}

Node contains information about each node

type Pool

type Pool struct {
	ActiveMemberCount int          `ltm:"active-member-cnt"`
	Name              string       `ltm:"name"`
	MonitorRule       string       `ltm:"monitor-rule"`
	AvailabilityState string       `ltm:"status.availability-state"`
	EnabledState      string       `ltm:"status.enabled-state"`
	StatusReason      string       `ltm:"status.status-reason"`
	PoolMembers       []PoolMember `ltm:"members"`
}

Pool contains information about each Pool

type PoolMember

type PoolMember struct {
	Name              string `ltm:"node-name"`
	Addr              string `ltm:"addr"`
	Port              int    `ltm:"port"`
	MonitorRule       string `ltm:"monitor-rule"`
	MonitorStatus     string `ltm:"monitor-status"`
	EnabledState      string `ltm:"status.enabled-state"`
	AvailabilityState string `ltm:"status.availability-state"`
	StatusReason      string `ltm:"status.status-reason"`
}

Pool contains information about each pool member in a pool

type Profile

type Profile struct {
	Context string `ltm:"context"`
}

type SSH

type SSH interface {
	Send(cmd string) (int, error)
	Recv(suffix string) ([]byte, error)
	Close() error
}

type Token

type Token struct {
	// contains filtered or unexported fields
}

type VirtualServer

type VirtualServer struct {
	Name        string             `ltm:"name"`
	Destination string             `ltm:"destination"`
	IpProtocol  string             `ltm:"ip-protocol"`
	Mask        string             `ltm:"mask"`
	Partition   string             `ltm:"partition"`
	Pool        string             `ltm:"pool"`
	Profiles    map[string]Profile `ltm:"profiles"`
}

VirtualServer contains information about each virtual server

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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