apicapi

package
v0.0.0-...-9647dda Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Interface for connecting to APIC REST API using websockets

Index

Constants

View Source
const (
	ApicNameAliasLength                = 64
	ApicSubscriptionResponseMoMaxCount = 100000
)

Variables

View Source
var (
	ApicVersion = "3.1"
)

ApicVersion - This global variable to be used when dealing with version- dependencies during APIC interaction. It gets filled with actual version as part of runConn()

Functions

func AddMetaDataChild

func AddMetaDataChild(parent, child string) error

Types

type ApicConnection

type ApicConnection struct {
	Apic      []string
	ApicIndex int

	CachedVersion       string
	ReconnectInterval   time.Duration
	ReconnectRetryLimit int
	RefreshInterval     time.Duration
	RefreshTickerAdjust time.Duration
	SubscriptionDelay   time.Duration
	RetryInterval       time.Duration
	SnatPbrFltrChain    bool // Configure SNAT PBR to use filter-chain
	FullSyncHook        func()

	SyncDone  bool
	SyncMutex sync.Mutex

	CachedSubnetDns map[string]string
	// contains filtered or unexported fields
}

func New

func New(log *logrus.Logger, apic []string, user string,
	password string, privKey []byte, cert []byte,
	prefix string, refresh int, refreshTickerAdjust int,
	subscriptionDelay int, vrfTenant string) (*ApicConnection, error)

func (*ApicConnection) AddSubscriptionClass

func (conn *ApicConnection) AddSubscriptionClass(class string,
	targetClasses []string, targetFilter string)

func (*ApicConnection) AddSubscriptionDn

func (conn *ApicConnection) AddSubscriptionDn(dn string,
	targetClasses []string)

func (*ApicConnection) AddSubscriptionTree

func (conn *ApicConnection) AddSubscriptionTree(class string,
	targetClasses []string, targetFilter string)

AddSubscriptionTree subscribe at a subtree level. class specifies the root. Changes will cause entire subtree of the rootdn to be fetched

func (*ApicConnection) ClearApicContainer

func (conn *ApicConnection) ClearApicContainer(key string)

func (*ApicConnection) ClearApicObjects

func (conn *ApicConnection) ClearApicObjects(key string)

func (*ApicConnection) Delete

func (conn *ApicConnection) Delete(dn string) bool

func (*ApicConnection) DeleteDn

func (conn *ApicConnection) DeleteDn(dn string) bool

func (*ApicConnection) DeleteDnInline

func (conn *ApicConnection) DeleteDnInline(dn string) error

func (*ApicConnection) ForceRelogin

func (conn *ApicConnection) ForceRelogin()

func (*ApicConnection) GetApicResponse

func (conn *ApicConnection) GetApicResponse(uri string) (ApicResponse, error)

func (*ApicConnection) GetDesiredState

func (conn *ApicConnection) GetDesiredState(key string) ApicSlice

func (*ApicConnection) GetVersion

func (conn *ApicConnection) GetVersion() (string, error)

This function should only to be called before we make the first connection to APIC. Use the cached Apic version when determining the version elsewhere. This can lead to inconsistent tokens.

func (*ApicConnection) PostDnInline

func (conn *ApicConnection) PostDnInline(dn string, obj ApicObject) error

func (*ApicConnection) PostTestAPI

func (conn *ApicConnection) PostTestAPI(data interface{}) error

func (*ApicConnection) Run

func (conn *ApicConnection) Run(stopCh <-chan struct{})

func (*ApicConnection) SetSubscriptionHooks

func (conn *ApicConnection) SetSubscriptionHooks(value string,
	updateHook ApicObjectHandler, deleteHook ApicDnHandler)

func (*ApicConnection) ValidateAciVrfAssociation

func (conn *ApicConnection) ValidateAciVrfAssociation(acivrfdn string, expectedVrfRelations []string) error

To make sure cluster's POD/NodeBDs and L3OUT are all mapped to same and correct VRF.

func (*ApicConnection) WriteApicContainer

func (conn *ApicConnection) WriteApicContainer(key string, objects ApicSlice)

func (*ApicConnection) WriteApicObjects

func (conn *ApicConnection) WriteApicObjects(key string, objects ApicSlice)

func (*ApicConnection) WriteStaticApicObjects

func (conn *ApicConnection) WriteStaticApicObjects(key string, objects ApicSlice)

type ApicDnHandler

type ApicDnHandler func(string)

type ApicObject

type ApicObject map[string]*ApicObjectBody

func EmptyApicObject

func EmptyApicObject(class, dn string) ApicObject

func NewCloudApp

func NewCloudApp(tenantName, name string) ApicObject

func NewCloudAwsProvider

func NewCloudAwsProvider(tenant, region, providerID string) ApicObject

func NewCloudCidr

func NewCloudCidr(cCtxDn, addr string) ApicObject

func NewCloudCtxProfile

func NewCloudCtxProfile(tenant, name string) ApicObject

func NewCloudEpg

func NewCloudEpg(tenantName, appName, name string) ApicObject

func NewCloudRsCtxProfileToRegion

func NewCloudRsCtxProfileToRegion(cCtxDn, tDn string) ApicObject

func NewCloudRsToCtx

func NewCloudRsToCtx(cCtxDn, ctxName string) ApicObject

func NewCloudSubnet

func NewCloudSubnet(cidrDn, ip string) ApicObject

func NewDeleteHostprotRemoteIp

func NewDeleteHostprotRemoteIp(addr string) ApicObject

func NewFvAEPg

func NewFvAEPg(tenant, ap, name string) ApicObject

func NewFvAP

func NewFvAP(tenant, ap string) ApicObject

func NewFvBD

func NewFvBD(tenantName, name string) ApicObject

func NewFvCtx

func NewFvCtx(tenantName, name string) ApicObject

func NewFvIPSLAMonitoringPol

func NewFvIPSLAMonitoringPol(tenantName, name string) ApicObject

func NewFvRsBD

func NewFvRsBD(parentDn, bdName string) ApicObject

func NewFvRsCons

func NewFvRsCons(parentDn, tnVzBrCPName string) ApicObject

func NewFvRsCtx

func NewFvRsCtx(parentDn, vrfName string) ApicObject

func NewFvRsDomAttPhysDom

func NewFvRsDomAttPhysDom(parentDn, physDom string) ApicObject

func NewFvRsPathAtt

func NewFvRsPathAtt(parentDn, path, encap, mode string) ApicObject

func NewFvRsProv

func NewFvRsProv(parentDn, tnVzBrCPName string) ApicObject

func NewFvSubnet

func NewFvSubnet(parentDn, gwIpMask string) ApicObject

func NewFvTenant

func NewFvTenant(name string) ApicObject

func NewFvnsEncapBlk

func NewFvnsEncapBlk(parentDn, from, to string) ApicObject

func NewFvnsVlanInstP

func NewFvnsVlanInstP(tenant, name string) ApicObject

func NewHostprotPol

func NewHostprotPol(tenantName, name string) ApicObject

func NewHostprotRemoteIp

func NewHostprotRemoteIp(parentDn, addr string) ApicObject

func NewHostprotRule

func NewHostprotRule(parentDn, name string) ApicObject

func NewHostprotSubj

func NewHostprotSubj(parentDn, name string) ApicObject

func NewInfra

func NewInfra(parentDn string) ApicObject

func NewInfraAccBndlGrp

func NewInfraAccBndlGrp(name string) ApicObject

func NewInfraAccPortGrp

func NewInfraAccPortGrp(name string) ApicObject

func NewInfraGeneric

func NewInfraGeneric(aep string) ApicObject

func NewInfraRsDomP

func NewInfraRsDomP(parentDn, tDn string) ApicObject

func NewInfraRsFuncToEpg

func NewInfraRsFuncToEpg(parentDn, epgDn, vlan, mode string) ApicObject

func NewInfraRsSpanVDestGrp

func NewInfraRsSpanVDestGrp(accBndlGrpName, tnSpanVDestGrpName string) ApicObject

func NewInfraRsSpanVDestGrpAP

func NewInfraRsSpanVDestGrpAP(accPortGrpName, tnSpanVDestGrpName string) ApicObject

func NewInfraRsSpanVSrcGrp

func NewInfraRsSpanVSrcGrp(accBndlGrpName, tnSpanVSrcGrpName string) ApicObject

func NewInfraRsSpanVSrcGrpAP

func NewInfraRsSpanVSrcGrpAP(accPortGrpName, tnSpanVSrcGrpName string) ApicObject

func NewInfraRsVlanNs

func NewInfraRsVlanNs(parentDn, tDn string) ApicObject

func NewL3extInstP

func NewL3extInstP(tenantName, outName, name string) ApicObject

func NewL3extSubnet

func NewL3extSubnet(parentDn, ip string) ApicObject

func NewNetflowVmmExporterPol

func NewNetflowVmmExporterPol(name string) ApicObject

func NewPhysDomP

func NewPhysDomP(physDom string) ApicObject

func NewQosDppPol

func NewQosDppPol(tenantName, name string) ApicObject

func NewQosEpDscpMarking

func NewQosEpDscpMarking(qosreqDn, name string) ApicObject

func NewQosRequirement

func NewQosRequirement(tenantName, name string) ApicObject

func NewRsBdToOut

func NewRsBdToOut(parentDn, l3out string) ApicObject

func NewRsCtx

func NewRsCtx(parentDn, ctx string) ApicObject

func NewRsEgressDppPol

func NewRsEgressDppPol(parentDn, dppPolName string) ApicObject

func NewRsIngressDppPol

func NewRsIngressDppPol(parentDn, dppPolName string) ApicObject

func NewSpanRsSrcToVPort

func NewSpanRsSrcToVPort(parentDn, tDn string) ApicObject

func NewSpanSpanLbl

func NewSpanSpanLbl(vSourceGroup, name string) ApicObject

func NewSpanVDest

func NewSpanVDest(vDestGroup, name string) ApicObject

func NewSpanVDestGrp

func NewSpanVDestGrp(name string) ApicObject

func NewSpanVEpgSummary

func NewSpanVEpgSummary(parentDn string) ApicObject

func NewSpanVSrc

func NewSpanVSrc(vSourceGroup, name string) ApicObject

func NewSpanVSrcGrp

func NewSpanVSrcGrp(name string) ApicObject

func NewTagAnnotation

func NewTagAnnotation(parentDn, key string) ApicObject

func NewTagInst

func NewTagInst(parentDn, name string) ApicObject

func NewVmmClusterFaultInfo

func NewVmmClusterFaultInfo(parentDn, faultCode string) ApicObject

func NewVmmInjectedClusterInfo

func NewVmmInjectedClusterInfo(vendor, domain, controller string) ApicObject

func NewVmmInjectedContGrp

func NewVmmInjectedContGrp(vendor string, domain string, controller string,
	namespace string, name string) ApicObject

func NewVmmInjectedDepl

func NewVmmInjectedDepl(vendor string, domain string, controller string,
	namespace string, name string) ApicObject

func NewVmmInjectedHost

func NewVmmInjectedHost(vendor, domain, controller, name string) ApicObject

func NewVmmInjectedLabel

func NewVmmInjectedLabel(parentDn, name, value string) ApicObject

func NewVmmInjectedNs

func NewVmmInjectedNs(vendor, domain, controller, name string) ApicObject

func NewVmmInjectedNwPol

func NewVmmInjectedNwPol(vendor, domain, controller, ns, name string) ApicObject

func NewVmmInjectedOrg

func NewVmmInjectedOrg(vendor, domain, controller, name string) ApicObject

func NewVmmInjectedOrgUnit

func NewVmmInjectedOrgUnit(vendor, domain, controller, org, name string) ApicObject

func NewVmmInjectedOrgUnitContGrp

func NewVmmInjectedOrgUnitContGrp(vendor, domain, controller, org, unit, name string) ApicObject

func NewVmmInjectedOrgUnitDepl

func NewVmmInjectedOrgUnitDepl(vendor, domain, controller, org, unit, name string) ApicObject

func NewVmmInjectedReplSet

func NewVmmInjectedReplSet(vendor string, domain string, controller string,
	namespace string, name string) ApicObject

func NewVmmInjectedSvc

func NewVmmInjectedSvc(vendor string, domain string, controller string,
	namespace string, name string) ApicObject

func NewVmmInjectedSvcEp

func NewVmmInjectedSvcEp(parentDn, contGrpName string) ApicObject

func NewVmmInjectedSvcPort

func NewVmmInjectedSvcPort(parentDn, port string,
	protocol string, targetPort string) ApicObject

func NewVmmRsVswitchExporterPol

func NewVmmRsVswitchExporterPol(parentDn, tDn string) ApicObject

func NewVmmVSwitchPolicyCont

func NewVmmVSwitchPolicyCont(domainType, domainName string) ApicObject

func NewVnsAbsConnection

func NewVnsAbsConnection(parentDn, name string) ApicObject

func NewVnsAbsFuncConn

func NewVnsAbsFuncConn(parentDn, name string) ApicObject

func NewVnsAbsGraph

func NewVnsAbsGraph(tenantName, name string) ApicObject

func NewVnsAbsNode

func NewVnsAbsNode(parentDn, name string) ApicObject

func NewVnsAbsTermConn

func NewVnsAbsTermConn(parentDn string) ApicObject

func NewVnsAbsTermNodeCon

func NewVnsAbsTermNodeCon(parentDn, name string) ApicObject

func NewVnsAbsTermNodeProv

func NewVnsAbsTermNodeProv(parentDn, name string) ApicObject

func NewVnsCDev

func NewVnsCDev(parentDn, name string) ApicObject

func NewVnsCif

func NewVnsCif(parentDn, name string) ApicObject

func NewVnsInTerm

func NewVnsInTerm(parentDn string) ApicObject

func NewVnsLDevCtx

func NewVnsLDevCtx(tenantName, ctrctNameOrLbl string,
	graphNameOrLbl string, nodeNameOrLbl string) ApicObject

func NewVnsLDevVip

func NewVnsLDevVip(tenantName, name string) ApicObject

func NewVnsLIf

func NewVnsLIf(parentDn, name string) ApicObject

func NewVnsLIfCtx

func NewVnsLIfCtx(parentDn, connNameOrLbl string) ApicObject

func NewVnsOutTerm

func NewVnsOutTerm(parentDn string) ApicObject

func NewVnsRedirectDest

func NewVnsRedirectDest(parentDn, ip, mac string) ApicObject

func NewVnsRedirectHealthGroup

func NewVnsRedirectHealthGroup(tenantName, name string) ApicObject

func NewVnsRsALDevToPhysDomP

func NewVnsRsALDevToPhysDomP(parentDn, physDomDn string) ApicObject

func NewVnsRsAbsConnectionConns

func NewVnsRsAbsConnectionConns(parentDn, tDn string) ApicObject

func NewVnsRsCIfAttN

func NewVnsRsCIfAttN(parentDn, cifDn string) ApicObject

func NewVnsRsCIfPathAtt

func NewVnsRsCIfPathAtt(parentDn, pathDn string) ApicObject

func NewVnsRsIPSLAMonitoringPol

func NewVnsRsIPSLAMonitoringPol(parentDn, tDn string) ApicObject

func NewVnsRsLDevCtxToLDev

func NewVnsRsLDevCtxToLDev(parentDn, tDn string) ApicObject

func NewVnsRsLIfCtxToBD

func NewVnsRsLIfCtxToBD(parentDn, tDn string) ApicObject

func NewVnsRsLIfCtxToLIf

func NewVnsRsLIfCtxToLIf(parentDn, tDn string) ApicObject

func NewVnsRsLIfCtxToSvcRedirectPol

func NewVnsRsLIfCtxToSvcRedirectPol(parentDn, tDn string) ApicObject

func NewVnsRsNodeToLDev

func NewVnsRsNodeToLDev(parentDn, tDn string) ApicObject

func NewVnsRsRedirectHealthGroup

func NewVnsRsRedirectHealthGroup(parentDn, tDn string) ApicObject

func NewVnsSvcRedirectPol

func NewVnsSvcRedirectPol(tenantName, name string) ApicObject

func NewVzBrCP

func NewVzBrCP(tenantName, name string) ApicObject

func NewVzEntry

func NewVzEntry(parentDn, name string) ApicObject

func NewVzFilter

func NewVzFilter(tenantName, name string) ApicObject

func NewVzInTerm

func NewVzInTerm(parentDn string) ApicObject

func NewVzOutTerm

func NewVzOutTerm(parentDn string) ApicObject

func NewVzRsFiltAtt

func NewVzRsFiltAtt(parentDn, tnVzFilterName string) ApicObject

func NewVzRsInTermGraphAtt

func NewVzRsInTermGraphAtt(parentDn, tnVnsAbsGraphName string) ApicObject

func NewVzRsOutTermGraphAtt

func NewVzRsOutTermGraphAtt(parentDn, tnVnsAbsGraphName string) ApicObject

func NewVzRsSubjFiltAtt

func NewVzRsSubjFiltAtt(parentDn, tnVzFilterName string) ApicObject

func NewVzRsSubjGraphAtt

func NewVzRsSubjGraphAtt(parentDn, tnVnsAbsGraphName string, customSG bool) ApicObject

func NewVzSubj

func NewVzSubj(parentDn, name string) ApicObject

func (ApicObject) AddChild

func (o ApicObject) AddChild(c ApicObject)

func (ApicObject) BuildDn

func (o ApicObject) BuildDn(parentDn string) string

func (ApicObject) Copy

func (o ApicObject) Copy() ApicObject

func (ApicObject) GetAttr

func (o ApicObject) GetAttr(name string) interface{}

func (ApicObject) GetAttrDn

func (o ApicObject) GetAttrDn() string

func (ApicObject) GetAttrStr

func (o ApicObject) GetAttrStr(name string) string

func (ApicObject) GetDn

func (o ApicObject) GetDn() string

func (ApicObject) GetHintDn

func (o ApicObject) GetHintDn() string

func (ApicObject) GetRn

func (o ApicObject) GetRn() string

func (ApicObject) GetTag

func (o ApicObject) GetTag() string

func (ApicObject) SetAttr

func (o ApicObject) SetAttr(name string, value interface{}) ApicObject

func (ApicObject) SetTag

func (o ApicObject) SetTag(tag string)

func (ApicObject) String

func (o ApicObject) String() string

type ApicObjectBody

type ApicObjectBody struct {
	HintDn     string                 `json:"-"`
	Attributes map[string]interface{} `json:"attributes,omitempty"`
	Children   ApicSlice              `json:"children,omitempty"`
}

type ApicObjectHandler

type ApicObjectHandler func(ApicObject) bool

type ApicResponse

type ApicResponse struct {
	TotalCount     interface{}  `json:"totalCount"`
	SubscriptionId interface{}  `json:"subscriptionId,omitempty"`
	Imdata         []ApicObject `json:"imdata"`
}

type ApicSlice

type ApicSlice []ApicObject

func PrepareApicSlice

func PrepareApicSlice(objects ApicSlice, prefix, key string) ApicSlice

func (ApicSlice) Copy

func (s ApicSlice) Copy() ApicSlice

func (ApicSlice) Len

func (s ApicSlice) Len() int

func (ApicSlice) Less

func (s ApicSlice) Less(i, j int) bool

func (ApicSlice) Swap

func (s ApicSlice) Swap(i, j int)

Jump to

Keyboard shortcuts

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