Documentation
¶
Overview ¶
Package aci is a Go module for interacting with Cisco ACI using API calls.
Example
package main
import (
"fmt"
"github.com/udhos/acigo/aci"
)
func main() {
a, errNew := aci.New(aci.ClientOptions{})
if errNew != nil {
fmt.Printf("login new client error: %v\n", errNew)
return
}
// Since credentials have not been specified explicitly under ClientOptions,
// Login() will use env vars: APIC_HOSTS=host, APIC_USER=username, APIC_PASS=pwd
errLogin := a.Login()
if errLogin != nil {
fmt.Printf("login error: %v\n", errLogin)
return
}
errAdd := a.TenantAdd("tenant-example", "")
if errAdd != nil {
fmt.Printf("tenant add error: %v\n", errAdd)
return
}
errLogout := a.Logout()
if errLogout != nil {
fmt.Printf("logout error: %v\n", errLogout)
return
}
}
See also ¶
Cisco APIC REST API User Guide: http://www.cisco.com/c/en/us/td/docs/switches/datacenter/aci/apic/sw/1-x/api/rest/b_APIC_RESTful_API_User_Guide.html
APIC Management Information Model Reference: https://developer.cisco.com/media/mim-ref
Index ¶
- Constants
- type Client
- func (c *Client) ApplicationEPGAdd(tenant, applicationProfile, bridgeDomain, epg, descr string) error
- func (c *Client) ApplicationEPGDel(tenant, applicationProfile, epg string) error
- func (c *Client) ApplicationEPGList(tenant, applicationProfile string) ([]map[string]interface{}, error)
- func (c *Client) ApplicationProfileAdd(tenant, name, descr string) error
- func (c *Client) ApplicationProfileDel(tenant, name string) error
- func (c *Client) ApplicationProfileList(tenant string) ([]map[string]interface{}, error)
- func (c *Client) BridgeDomainAdd(tenant, bd, descr string) error
- func (c *Client) BridgeDomainDel(tenant, bd string) error
- func (c *Client) BridgeDomainL3ExtOutAdd(tenant, bd, out string) error
- func (c *Client) BridgeDomainL3ExtOutDel(tenant, bd, out string) error
- func (c *Client) BridgeDomainL3ExtOutList(tenant, bd string) ([]map[string]interface{}, error)
- func (c *Client) BridgeDomainList(tenant string) ([]map[string]interface{}, error)
- func (c *Client) BridgeDomainSubnetAdd(tenant, bd, subnet, descr string) error
- func (c *Client) BridgeDomainSubnetDel(tenant, bd, subnet string) error
- func (c *Client) BridgeDomainSubnetGet(tenant, bd, subnet string) ([]map[string]interface{}, error)
- func (c *Client) BridgeDomainSubnetList(tenant, bd string) ([]map[string]interface{}, error)
- func (c *Client) BridgeDomainSubnetScopeGet(tenant, bd, subnet string) (string, error)
- func (c *Client) BridgeDomainSubnetScopeSet(tenant, bd, subnet, scope string) error
- func (c *Client) BridgeDomainVrfGet(tenant, bd string) (string, error)
- func (c *Client) BridgeDomainVrfSet(tenant, bd, vrf string) error
- func (c *Client) ExportConfigurationAdd(config, scheduler, remoteLocation, descr string) error
- func (c *Client) ExportConfigurationDel(config string) error
- func (c *Client) ExportConfigurationList() ([]map[string]interface{}, error)
- func (c *Client) ExportConfigurationRemoteLocationGet(config string) (map[string]interface{}, error)
- func (c *Client) ExportConfigurationRun(config string) error
- func (c *Client) ExportConfigurationSchedulerGet(config string) (map[string]interface{}, error)
- func (c *Client) ExternalRoutedDomainAdd(dom string) error
- func (c *Client) ExternalRoutedDomainDel(dom string) error
- func (c *Client) ExternalRoutedDomainList() ([]map[string]interface{}, error)
- func (c *Client) L3ExtOutAdd(tenant, out, descr string) error
- func (c *Client) L3ExtOutDel(tenant, out string) error
- func (c *Client) L3ExtOutL3ExtDomainGet(tenant, out string) (string, error)
- func (c *Client) L3ExtOutL3ExtDomainSet(tenant, out, domain string) error
- func (c *Client) L3ExtOutList(tenant string) ([]map[string]interface{}, error)
- func (c *Client) L3ExtOutVrfGet(tenant, out string) (string, error)
- func (c *Client) L3ExtOutVrfSet(tenant, out, vrf string) error
- func (c *Client) Login() error
- func (c *Client) Logout() error
- func (c *Client) NodeList() ([]map[string]interface{}, error)
- func (c *Client) PhysicalDomainAdd(name, vlanpoolName, vlanpoolMode string) error
- func (c *Client) PhysicalDomainDel(name string) error
- func (c *Client) PhysicalDomainList() ([]map[string]interface{}, error)
- func (c *Client) PhysicalDomainVlanPoolGet(name string) (string, error)
- func (c *Client) Refresh() error
- func (c *Client) RefreshTimeout() time.Duration
- func (c *Client) RemoteLocationAdd(...) error
- func (c *Client) RemoteLocationDel(location string) error
- func (c *Client) RemoteLocationList() ([]map[string]interface{}, error)
- func (c *Client) TenantAdd(name, descr string) error
- func (c *Client) TenantDel(name string) error
- func (c *Client) TenantList() ([]map[string]interface{}, error)
- func (c *Client) TenantSubscribe() (string, error)
- func (c *Client) TenantSubscriptionRefresh(subscriptionId string) error
- func (c *Client) TenantSubscriptionTimeout() time.Duration
- func (c *Client) VlanPoolAdd(name, mode, descr string) error
- func (c *Client) VlanPoolDel(name, mode string) error
- func (c *Client) VlanPoolList() ([]map[string]interface{}, error)
- func (c *Client) VlanRangeAdd(vlanpoolName, vlanpoolMode, from, to string) error
- func (c *Client) VlanRangeDel(vlanpoolName, vlanpoolMode, from, to string) error
- func (c *Client) VlanRangeList(vlanpoolName, vlanpoolMode string) ([]map[string]interface{}, error)
- func (c *Client) VrfAdd(tenant, vrf, descr string) error
- func (c *Client) VrfDel(tenant, vrf string) error
- func (c *Client) VrfList(tenant string) ([]map[string]interface{}, error)
- func (c *Client) WebsocketOpen() error
- func (c *Client) WebsocketReadJSON(v interface{}) error
- type ClientOptions
Constants ¶
const ( ApicHosts = "APIC_HOSTS" // Env var. List of apic hostnames. Example: "1.1.1.1" or "1.1.1.1,2.2.2.2,3.3.3.3" or "apic1,4.4.4.4" ApicUser = "APIC_USER" // Env var. Username. Example: "joe" ApicPass = "APIC_PASS" // Env var. Password. Example: "joesecret" )
Environment variables used as default parameters.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
Opt ClientOptions // Options for the APIC client
// contains filtered or unexported fields
}
Client is an instance for interacting with ACI using API calls.
func New ¶
func New(o ClientOptions) (*Client, error)
New creates a new Client instance for interacting with ACI using API calls.
func (*Client) ApplicationEPGAdd ¶
func (c *Client) ApplicationEPGAdd(tenant, applicationProfile, bridgeDomain, epg, descr string) error
ApplicationEPGAdd creates a new application EPG in an application profile and attached to a bridge domain.
func (*Client) ApplicationEPGDel ¶
ApplicationEPGDel deletes an existing application EPG from an application profile.
func (*Client) ApplicationEPGList ¶
func (c *Client) ApplicationEPGList(tenant, applicationProfile string) ([]map[string]interface{}, error)
ApplicationEPGList retrieves the list of application EPGs in an application profile.
func (*Client) ApplicationProfileAdd ¶
ApplicationProfileAdd creates a new application profile in a tenant.
func (*Client) ApplicationProfileDel ¶
ApplicationProfileDel deletes an existing application profile from a tenant.
func (*Client) ApplicationProfileList ¶
ApplicationProfileList retrieves application profiles from a tenant.
func (*Client) BridgeDomainAdd ¶
BridgeDomainAdd creates a new bridge domain in a tenant.
func (*Client) BridgeDomainDel ¶
BridgeDomainDel deletes an existing bridge domain from a tenant.
func (*Client) BridgeDomainL3ExtOutAdd ¶
BridgeDomainL3ExtOutAdd attaches a new L3 External Outside in a bridge domain.
func (*Client) BridgeDomainL3ExtOutDel ¶
BridgeDomainL3ExtOutDel detaches an existing L3 External Outside from a bridge domain.
func (*Client) BridgeDomainL3ExtOutList ¶
BridgeDomainL3ExtOutList retrieves the list of L3 External Outsides attached to a bridge domain.
func (*Client) BridgeDomainList ¶
BridgeDomainList retrieves the list of bridge domains from a tenant.
func (*Client) BridgeDomainSubnetAdd ¶
BridgeDomainSubnetAdd creates a new subnet in a bridge domain.
func (*Client) BridgeDomainSubnetDel ¶
BridgeDomainSubnetDel deletes an existing subnet from a bridge domain.
func (*Client) BridgeDomainSubnetGet ¶
BridgeDomainSubnetGet retrieves specific subnet from a bridge domain.
func (*Client) BridgeDomainSubnetList ¶
BridgeDomainSubnetList retrieves the list of subnets from a bridge domain.
func (*Client) BridgeDomainSubnetScopeGet ¶
BridgeDomainSubnetScopeGet retrieves the scope from a bridge domain subnet.
func (*Client) BridgeDomainSubnetScopeSet ¶
BridgeDomainSubnetScopeSet defines the scope for a bridge domain subnet.
func (*Client) BridgeDomainVrfGet ¶
BridgeDomainVrfGet retrieves the VRF for a bridge domain.
func (*Client) BridgeDomainVrfSet ¶
BridgeDomainVrfSet defines the VRF for a bridge domain.
func (*Client) ExportConfigurationAdd ¶
ExportConfigurationAdd creates a new export configuration.
func (*Client) ExportConfigurationDel ¶
ExportConfigurationDel deletes an existing export configuration.
func (*Client) ExportConfigurationList ¶
ExportConfigurationList retrieves the list of export configurations.
func (*Client) ExportConfigurationRemoteLocationGet ¶
func (c *Client) ExportConfigurationRemoteLocationGet(config string) (map[string]interface{}, error)
ExportConfigurationRemoteLocationGet retrieves the remote location attached to an export configuration.
func (*Client) ExportConfigurationRun ¶
ExportConfigurationRun executes the export configuration now.
func (*Client) ExportConfigurationSchedulerGet ¶
ExportConfigurationSchedulerGet retrieves the scheduler attached to an export configuration.
func (*Client) ExternalRoutedDomainAdd ¶
ExternalRoutedDomainAdd creates a new L3 External Domain.
func (*Client) ExternalRoutedDomainDel ¶
ExternalRoutedDomainDel deletes an existing L3 External Domain.
func (*Client) ExternalRoutedDomainList ¶
ExternalRoutedDomainList retrieves the list of L3 External Domains.
func (*Client) L3ExtOutAdd ¶
L3ExtOutAdd creates a new external routed network in a tenant.
func (*Client) L3ExtOutDel ¶
L3ExtOutDel deletes an external routed network from a tenant.
func (*Client) L3ExtOutL3ExtDomainGet ¶
L3ExtOutL3ExtDomainGet retrieves the external routed domain for an external routed network.
func (*Client) L3ExtOutL3ExtDomainSet ¶
L3ExtOutL3ExtDomainSet defines the external routed domain for an external routed network.
func (*Client) L3ExtOutList ¶
L3ExtOutList retrieves the list of external routed networks from a tenant.
func (*Client) L3ExtOutVrfGet ¶
L3ExtOutVrfGet retrieves the VRF for an external routed network.
func (*Client) L3ExtOutVrfSet ¶
L3ExtOutVrfSet defines the VRF for an external routed network.
func (*Client) NodeList ¶
NodeList retrieves the list of top level system elements (APICs, spines, leaves).
func (*Client) PhysicalDomainAdd ¶
PhysicalDomainAdd creates a new physical domain.
func (*Client) PhysicalDomainDel ¶
PhysicalDomainDel deletes an existing physical domain.
func (*Client) PhysicalDomainList ¶
PhysicalDomainList retrieves the list of physical domains.
func (*Client) PhysicalDomainVlanPoolGet ¶
PhysicalDomainVlanPoolGet retrieves the VLAN pool for the physical domain.
func (*Client) Refresh ¶
Refresh resets the session timer on APIC using the API aaaRefresh. In order to keep the session active, Refresh() must be called at a period lower than the timeout reported by RefreshTimeout().
func (*Client) RefreshTimeout ¶
RefreshTimeout gets the session timeout reported by last API call to APIC. In order to keep the session active, Refresh() must be called at a period lower than the timeout reported by RefreshTimeout().
func (*Client) RemoteLocationAdd ¶
func (c *Client) RemoteLocationAdd(location, host, protocol, remotePort, remotePath, username, password, descr string) error
RemoteLocationAdd creates a new remote location.
func (*Client) RemoteLocationDel ¶
RemoteLocationDel deletes an existing remote location.
func (*Client) RemoteLocationList ¶
RemoteLocationList retrieves the list of remote locations.
func (*Client) TenantList ¶
TenantList retrieves the list of tenants.
func (*Client) TenantSubscribe ¶
TenantSubscribe subscribes to tenant notifications. The subscriptionId is returned.
func (*Client) TenantSubscriptionRefresh ¶
TenantSubscriptionRefresh refreshes a subscription. In order to keep the subscription active, TenantSubscriptionRefresh() must be called at a period lower than the timeout reported by TenantSubscriptionTimeout().
func (*Client) TenantSubscriptionTimeout ¶
TenantSubscriptionTimeout gets the subscription timeout. In order to keep the subscription active, TenantSubscriptionRefresh() must be called at a period lower than the timeout reported by TenantSubscriptionTimeout().
func (*Client) VlanPoolAdd ¶
VlanPoolAdd creates a new VLAN pool.
func (*Client) VlanPoolDel ¶
VlanPoolDel deletes an existing VLAN pool.
func (*Client) VlanPoolList ¶
VlanPoolList retrieves the list of VLAN pools.
func (*Client) VlanRangeAdd ¶
VlanRangeAdd creates a new VLAN range for a VLAN pool.
func (*Client) VlanRangeDel ¶
VlanRangeDel deletes an existing VLAN range from a VLAN pool.
func (*Client) VlanRangeList ¶
VlanRangeList retrieves the list of VLAN ranges from a VLAN pool.
func (*Client) WebsocketOpen ¶
WebsocketOpen opens websocket for receiving subscription information.
func (*Client) WebsocketReadJSON ¶
WebsocketReadJSON reads subscription message from websocket.
type ClientOptions ¶
type ClientOptions struct {
Hosts []string // List of apic hostnames. If unspecified, env var APIC_HOSTS is used.
User string // Username. If unspecified, env var APIC_USER is used.
Pass string // Password. If unspecified, env var APIC_PASS is used.
Debug bool // Debug enables verbose debugging messages to console.
}
ClientOptions is used to specify options for the Client.