id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
7,800 | contiv/netplugin | netmaster/mastercfg/policyState.go | InitPolicyMgr | func InitPolicyMgr(stateDriver core.StateDriver, ofm *ofnet.OfnetMaster) error {
// save statestore and ofnet masters
stateStore = stateDriver
ofnetMaster = ofm
// restore all existing epg policies
err := restoreEpgPolicies(stateDriver)
if err != nil {
log.Errorf("Error restoring EPG policies. ")
}
return ni... | go | func InitPolicyMgr(stateDriver core.StateDriver, ofm *ofnet.OfnetMaster) error {
// save statestore and ofnet masters
stateStore = stateDriver
ofnetMaster = ofm
// restore all existing epg policies
err := restoreEpgPolicies(stateDriver)
if err != nil {
log.Errorf("Error restoring EPG policies. ")
}
return ni... | [
"func",
"InitPolicyMgr",
"(",
"stateDriver",
"core",
".",
"StateDriver",
",",
"ofm",
"*",
"ofnet",
".",
"OfnetMaster",
")",
"error",
"{",
"// save statestore and ofnet masters",
"stateStore",
"=",
"stateDriver",
"\n",
"ofnetMaster",
"=",
"ofm",
"\n\n",
"// restore a... | // InitPolicyMgr initializes the policy manager | [
"InitPolicyMgr",
"initializes",
"the",
"policy",
"manager"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netmaster/mastercfg/policyState.go#L60-L71 |
7,801 | contiv/netplugin | netmaster/mastercfg/policyState.go | NewEpgPolicy | func NewEpgPolicy(epgpKey string, epgID int, policy *contivModel.Policy) (*EpgPolicy, error) {
gp := new(EpgPolicy)
gp.EpgPolicyKey = epgpKey
gp.ID = epgpKey
gp.EndpointGroupID = epgID
gp.StateDriver = stateStore
log.Infof("Creating new epg policy: %s", epgpKey)
// init the dbs
gp.RuleMaps = make(map[string]*... | go | func NewEpgPolicy(epgpKey string, epgID int, policy *contivModel.Policy) (*EpgPolicy, error) {
gp := new(EpgPolicy)
gp.EpgPolicyKey = epgpKey
gp.ID = epgpKey
gp.EndpointGroupID = epgID
gp.StateDriver = stateStore
log.Infof("Creating new epg policy: %s", epgpKey)
// init the dbs
gp.RuleMaps = make(map[string]*... | [
"func",
"NewEpgPolicy",
"(",
"epgpKey",
"string",
",",
"epgID",
"int",
",",
"policy",
"*",
"contivModel",
".",
"Policy",
")",
"(",
"*",
"EpgPolicy",
",",
"error",
")",
"{",
"gp",
":=",
"new",
"(",
"EpgPolicy",
")",
"\n",
"gp",
".",
"EpgPolicyKey",
"=",... | // NewEpgPolicy creates a new policy instance attached to an endpoint group | [
"NewEpgPolicy",
"creates",
"a",
"new",
"policy",
"instance",
"attached",
"to",
"an",
"endpoint",
"group"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netmaster/mastercfg/policyState.go#L74-L117 |
7,802 | contiv/netplugin | netmaster/mastercfg/policyState.go | restoreEpgPolicies | func restoreEpgPolicies(stateDriver core.StateDriver) error {
// read all epg policies
gp := new(EpgPolicy)
gp.StateDriver = stateDriver
gpCfgs, err := gp.ReadAll()
if err == nil {
for _, gpCfg := range gpCfgs {
epgp := gpCfg.(*EpgPolicy)
log.Infof("Restoring EpgPolicy: %+v", epgp)
// save it in cache
... | go | func restoreEpgPolicies(stateDriver core.StateDriver) error {
// read all epg policies
gp := new(EpgPolicy)
gp.StateDriver = stateDriver
gpCfgs, err := gp.ReadAll()
if err == nil {
for _, gpCfg := range gpCfgs {
epgp := gpCfg.(*EpgPolicy)
log.Infof("Restoring EpgPolicy: %+v", epgp)
// save it in cache
... | [
"func",
"restoreEpgPolicies",
"(",
"stateDriver",
"core",
".",
"StateDriver",
")",
"error",
"{",
"// read all epg policies",
"gp",
":=",
"new",
"(",
"EpgPolicy",
")",
"\n",
"gp",
".",
"StateDriver",
"=",
"stateDriver",
"\n",
"gpCfgs",
",",
"err",
":=",
"gp",
... | // restoreEpgPolicies restores all EPG policies from state store | [
"restoreEpgPolicies",
"restores",
"all",
"EPG",
"policies",
"from",
"state",
"store"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netmaster/mastercfg/policyState.go#L120-L151 |
7,803 | contiv/netplugin | netmaster/mastercfg/policyState.go | Delete | func (gp *EpgPolicy) Delete() error {
// delete from the DB
delete(epgPolicyDb, gp.EpgPolicyKey)
return gp.Clear()
} | go | func (gp *EpgPolicy) Delete() error {
// delete from the DB
delete(epgPolicyDb, gp.EpgPolicyKey)
return gp.Clear()
} | [
"func",
"(",
"gp",
"*",
"EpgPolicy",
")",
"Delete",
"(",
")",
"error",
"{",
"// delete from the DB",
"delete",
"(",
"epgPolicyDb",
",",
"gp",
".",
"EpgPolicyKey",
")",
"\n\n",
"return",
"gp",
".",
"Clear",
"(",
")",
"\n",
"}"
] | // Delete deletes the epg policy | [
"Delete",
"deletes",
"the",
"epg",
"policy"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netmaster/mastercfg/policyState.go#L159-L164 |
7,804 | contiv/netplugin | netmaster/mastercfg/policyState.go | AddRule | func (gp *EpgPolicy) AddRule(rule *contivModel.Rule) error {
var dirs []string
// check if the rule exists already
if gp.RuleMaps[rule.Key] != nil {
// FIXME: see if we can update the rule
return core.Errorf("Rule already exists")
}
// Figure out all the directional rules we need to install
switch rule.Dire... | go | func (gp *EpgPolicy) AddRule(rule *contivModel.Rule) error {
var dirs []string
// check if the rule exists already
if gp.RuleMaps[rule.Key] != nil {
// FIXME: see if we can update the rule
return core.Errorf("Rule already exists")
}
// Figure out all the directional rules we need to install
switch rule.Dire... | [
"func",
"(",
"gp",
"*",
"EpgPolicy",
")",
"AddRule",
"(",
"rule",
"*",
"contivModel",
".",
"Rule",
")",
"error",
"{",
"var",
"dirs",
"[",
"]",
"string",
"\n\n",
"// check if the rule exists already",
"if",
"gp",
".",
"RuleMaps",
"[",
"rule",
".",
"Key",
... | // AddRule adds a rule to epg policy | [
"AddRule",
"adds",
"a",
"rule",
"to",
"epg",
"policy"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netmaster/mastercfg/policyState.go#L315-L368 |
7,805 | contiv/netplugin | netmaster/mastercfg/policyState.go | DelRule | func (gp *EpgPolicy) DelRule(rule *contivModel.Rule) error {
// check if the rule exists
ruleMap := gp.RuleMaps[rule.Key]
if ruleMap == nil {
return core.Errorf("Rule does not exists")
}
// Delete each ofnet rule under this policy rule
for _, ofnetRule := range ruleMap.OfnetRules {
log.Infof("Deleting rule {... | go | func (gp *EpgPolicy) DelRule(rule *contivModel.Rule) error {
// check if the rule exists
ruleMap := gp.RuleMaps[rule.Key]
if ruleMap == nil {
return core.Errorf("Rule does not exists")
}
// Delete each ofnet rule under this policy rule
for _, ofnetRule := range ruleMap.OfnetRules {
log.Infof("Deleting rule {... | [
"func",
"(",
"gp",
"*",
"EpgPolicy",
")",
"DelRule",
"(",
"rule",
"*",
"contivModel",
".",
"Rule",
")",
"error",
"{",
"// check if the rule exists",
"ruleMap",
":=",
"gp",
".",
"RuleMaps",
"[",
"rule",
".",
"Key",
"]",
"\n",
"if",
"ruleMap",
"==",
"nil",... | // DelRule removes a rule from epg policy | [
"DelRule",
"removes",
"a",
"rule",
"from",
"epg",
"policy"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netmaster/mastercfg/policyState.go#L371-L399 |
7,806 | contiv/netplugin | mgmtfn/mesosplugin/netcontiv/cniplugin.go | parseEnv | func (cniApp *cniAppInfo) parseEnv() error {
cniApp.logFields = make(logger.Fields)
envVal := ""
for _, envName := range cniEnvList {
if envVal = os.Getenv(envName); envVal == "" {
return fmt.Errorf("failed to get env variable %s", envName)
}
logger.Infof("parsed env variable %s = [%s]", envName, envVal)... | go | func (cniApp *cniAppInfo) parseEnv() error {
cniApp.logFields = make(logger.Fields)
envVal := ""
for _, envName := range cniEnvList {
if envVal = os.Getenv(envName); envVal == "" {
return fmt.Errorf("failed to get env variable %s", envName)
}
logger.Infof("parsed env variable %s = [%s]", envName, envVal)... | [
"func",
"(",
"cniApp",
"*",
"cniAppInfo",
")",
"parseEnv",
"(",
")",
"error",
"{",
"cniApp",
".",
"logFields",
"=",
"make",
"(",
"logger",
".",
"Fields",
")",
"\n",
"envVal",
":=",
"\"",
"\"",
"\n\n",
"for",
"_",
",",
"envName",
":=",
"range",
"cniEn... | // parse and save env. variables | [
"parse",
"and",
"save",
"env",
".",
"variables"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/mgmtfn/mesosplugin/netcontiv/cniplugin.go#L61-L105 |
7,807 | contiv/netplugin | mgmtfn/mesosplugin/netcontiv/cniplugin.go | parseNwInfoLabels | func (cniApp *cniAppInfo) parseNwInfoLabels() {
var cniNetInfo struct {
Args struct {
Mesos struct {
NetworkInfo struct {
Labels struct {
NwLabel []cniapi.NetworkLabel `json:"labels"`
} `json:"labels"`
} `json:"network_info"`
} `json:"org.apache.mesos"`
} `json:"args"`
}
cniLog.In... | go | func (cniApp *cniAppInfo) parseNwInfoLabels() {
var cniNetInfo struct {
Args struct {
Mesos struct {
NetworkInfo struct {
Labels struct {
NwLabel []cniapi.NetworkLabel `json:"labels"`
} `json:"labels"`
} `json:"network_info"`
} `json:"org.apache.mesos"`
} `json:"args"`
}
cniLog.In... | [
"func",
"(",
"cniApp",
"*",
"cniAppInfo",
")",
"parseNwInfoLabels",
"(",
")",
"{",
"var",
"cniNetInfo",
"struct",
"{",
"Args",
"struct",
"{",
"Mesos",
"struct",
"{",
"NetworkInfo",
"struct",
"{",
"Labels",
"struct",
"{",
"NwLabel",
"[",
"]",
"cniapi",
".",... | // parse labels from network_info | [
"parse",
"labels",
"from",
"network_info"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/mgmtfn/mesosplugin/netcontiv/cniplugin.go#L108-L151 |
7,808 | contiv/netplugin | mgmtfn/mesosplugin/netcontiv/cniplugin.go | sendCniResp | func (cniApp *cniAppInfo) sendCniResp(cniResp []byte, retCode int) int {
cniLog.Infof("sent CNI response: %s ", cniResp)
fmt.Printf("%s\n", string(cniResp))
return retCode
} | go | func (cniApp *cniAppInfo) sendCniResp(cniResp []byte, retCode int) int {
cniLog.Infof("sent CNI response: %s ", cniResp)
fmt.Printf("%s\n", string(cniResp))
return retCode
} | [
"func",
"(",
"cniApp",
"*",
"cniAppInfo",
")",
"sendCniResp",
"(",
"cniResp",
"[",
"]",
"byte",
",",
"retCode",
"int",
")",
"int",
"{",
"cniLog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"cniResp",
")",
"\n",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\""... | // send response received from netplugin to stdout | [
"send",
"response",
"received",
"from",
"netplugin",
"to",
"stdout"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/mgmtfn/mesosplugin/netcontiv/cniplugin.go#L154-L158 |
7,809 | contiv/netplugin | mgmtfn/mesosplugin/netcontiv/cniplugin.go | sendCniErrorResp | func (cniApp *cniAppInfo) sendCniErrorResp(errorMsg string) int {
cniLog.Infof("prepare CNI error response: %s ", errorMsg)
// CNI_ERROR_UNSUPPORTED is sent for all errors
cniResp := cniapi.CniCmdErrorResp{CniVersion: cniapi.CniDefaultVersion,
ErrCode: cniapi.CniStatusErrorUnsupportedField,
ErrMsg: "contiv: " +... | go | func (cniApp *cniAppInfo) sendCniErrorResp(errorMsg string) int {
cniLog.Infof("prepare CNI error response: %s ", errorMsg)
// CNI_ERROR_UNSUPPORTED is sent for all errors
cniResp := cniapi.CniCmdErrorResp{CniVersion: cniapi.CniDefaultVersion,
ErrCode: cniapi.CniStatusErrorUnsupportedField,
ErrMsg: "contiv: " +... | [
"func",
"(",
"cniApp",
"*",
"cniAppInfo",
")",
"sendCniErrorResp",
"(",
"errorMsg",
"string",
")",
"int",
"{",
"cniLog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"errorMsg",
")",
"\n",
"// CNI_ERROR_UNSUPPORTED is sent for all errors",
"cniResp",
":=",
"cniapi",
".",... | // send error response & return code | [
"send",
"error",
"response",
"&",
"return",
"code"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/mgmtfn/mesosplugin/netcontiv/cniplugin.go#L161-L182 |
7,810 | contiv/netplugin | mgmtfn/mesosplugin/netcontiv/cniplugin.go | handleHTTP | func (cniApp *cniAppInfo) handleHTTP(url string, jsonReq *bytes.Buffer) int {
cniLog.Infof("http POST url: %s data: %v", url, jsonReq)
httpResp, err := cniApp.httpClient.Post(url, "application/json", jsonReq)
if err != nil {
return cniApp.sendCniErrorResp("failed to get response from netplugin :" + err.Error())
... | go | func (cniApp *cniAppInfo) handleHTTP(url string, jsonReq *bytes.Buffer) int {
cniLog.Infof("http POST url: %s data: %v", url, jsonReq)
httpResp, err := cniApp.httpClient.Post(url, "application/json", jsonReq)
if err != nil {
return cniApp.sendCniErrorResp("failed to get response from netplugin :" + err.Error())
... | [
"func",
"(",
"cniApp",
"*",
"cniAppInfo",
")",
"handleHTTP",
"(",
"url",
"string",
",",
"jsonReq",
"*",
"bytes",
".",
"Buffer",
")",
"int",
"{",
"cniLog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"url",
",",
"jsonReq",
")",
"\n",
"httpResp",
",",
"err",
... | // handle http req & response to netplugin | [
"handle",
"http",
"req",
"&",
"response",
"to",
"netplugin"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/mgmtfn/mesosplugin/netcontiv/cniplugin.go#L185-L216 |
7,811 | contiv/netplugin | mgmtfn/mesosplugin/netcontiv/cniplugin.go | init | func (cniApp *cniAppInfo) init() {
cniApp.serverURL = "http://localhost"
trans := &http.Transport{Dial: func(network, addr string) (net.Conn,
error) {
return net.Dial("unix", cniapi.ContivMesosSocket)
}}
cniApp.httpClient = &http.Client{Transport: trans}
} | go | func (cniApp *cniAppInfo) init() {
cniApp.serverURL = "http://localhost"
trans := &http.Transport{Dial: func(network, addr string) (net.Conn,
error) {
return net.Dial("unix", cniapi.ContivMesosSocket)
}}
cniApp.httpClient = &http.Client{Transport: trans}
} | [
"func",
"(",
"cniApp",
"*",
"cniAppInfo",
")",
"init",
"(",
")",
"{",
"cniApp",
".",
"serverURL",
"=",
"\"",
"\"",
"\n\n",
"trans",
":=",
"&",
"http",
".",
"Transport",
"{",
"Dial",
":",
"func",
"(",
"network",
",",
"addr",
"string",
")",
"(",
"net... | // initialize netplugin client | [
"initialize",
"netplugin",
"client"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/mgmtfn/mesosplugin/netcontiv/cniplugin.go#L235-L243 |
7,812 | contiv/netplugin | version/version.go | Get | func Get() *Info {
ver := Info{}
ver.GitCommit = gitCommit
ver.Version = version
ver.BuildTime = buildTime
return &ver
} | go | func Get() *Info {
ver := Info{}
ver.GitCommit = gitCommit
ver.Version = version
ver.BuildTime = buildTime
return &ver
} | [
"func",
"Get",
"(",
")",
"*",
"Info",
"{",
"ver",
":=",
"Info",
"{",
"}",
"\n",
"ver",
".",
"GitCommit",
"=",
"gitCommit",
"\n",
"ver",
".",
"Version",
"=",
"version",
"\n",
"ver",
".",
"BuildTime",
"=",
"buildTime",
"\n\n",
"return",
"&",
"ver",
"... | // Get gets the version information | [
"Get",
"gets",
"the",
"version",
"information"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/version/version.go#L36-L43 |
7,813 | contiv/netplugin | version/version.go | StringFromInfo | func StringFromInfo(ver *Info) string {
return fmt.Sprintf("Version: %s\n", ver.Version) +
fmt.Sprintf("GitCommit: %s\n", ver.GitCommit) +
fmt.Sprintf("BuildTime: %s\n", ver.BuildTime)
} | go | func StringFromInfo(ver *Info) string {
return fmt.Sprintf("Version: %s\n", ver.Version) +
fmt.Sprintf("GitCommit: %s\n", ver.GitCommit) +
fmt.Sprintf("BuildTime: %s\n", ver.BuildTime)
} | [
"func",
"StringFromInfo",
"(",
"ver",
"*",
"Info",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\n",
"\"",
",",
"ver",
".",
"Version",
")",
"+",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\n",
"\"",
",",
"ver",
".",
"GitCommit",
")",
... | // StringFromInfo prints the versioning details | [
"StringFromInfo",
"prints",
"the",
"versioning",
"details"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/version/version.go#L52-L56 |
7,814 | contiv/netplugin | mgmtfn/dockplugin/dockplugin.go | InitDockPlugin | func InitDockPlugin(np *plugin.NetPlugin, mode string) error {
// Save state
netPlugin = np
pluginMode = mode
// Get local hostname
hostname, err := os.Hostname()
if err != nil {
log.Fatalf("Could not retrieve hostname: %v", err)
}
log.Debugf("Configuring router")
router := mux.NewRouter()
s := router.Me... | go | func InitDockPlugin(np *plugin.NetPlugin, mode string) error {
// Save state
netPlugin = np
pluginMode = mode
// Get local hostname
hostname, err := os.Hostname()
if err != nil {
log.Fatalf("Could not retrieve hostname: %v", err)
}
log.Debugf("Configuring router")
router := mux.NewRouter()
s := router.Me... | [
"func",
"InitDockPlugin",
"(",
"np",
"*",
"plugin",
".",
"NetPlugin",
",",
"mode",
"string",
")",
"error",
"{",
"// Save state",
"netPlugin",
"=",
"np",
"\n",
"pluginMode",
"=",
"mode",
"\n\n",
"// Get local hostname",
"hostname",
",",
"err",
":=",
"os",
"."... | // InitDockPlugin initializes the docker plugin | [
"InitDockPlugin",
"initializes",
"the",
"docker",
"plugin"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/mgmtfn/dockplugin/dockplugin.go#L44-L111 |
7,815 | contiv/netplugin | mgmtfn/dockplugin/dockplugin.go | deactivate | func deactivate(hostname string) func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
logEvent("deactivate")
}
} | go | func deactivate(hostname string) func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
logEvent("deactivate")
}
} | [
"func",
"deactivate",
"(",
"hostname",
"string",
")",
"func",
"(",
"http",
".",
"ResponseWriter",
",",
"*",
"http",
".",
"Request",
")",
"{",
"return",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
... | // deactivate the plugin | [
"deactivate",
"the",
"plugin"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/mgmtfn/dockplugin/dockplugin.go#L159-L163 |
7,816 | contiv/netplugin | mgmtfn/dockplugin/dockplugin.go | activate | func activate(hostname string) func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
logEvent("activate")
content, err := json.Marshal(plugins.Manifest{Implements: []string{"NetworkDriver", "IpamDriver"}})
if err != nil {
httpError(w, "Could not generate bootstrap r... | go | func activate(hostname string) func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
logEvent("activate")
content, err := json.Marshal(plugins.Manifest{Implements: []string{"NetworkDriver", "IpamDriver"}})
if err != nil {
httpError(w, "Could not generate bootstrap r... | [
"func",
"activate",
"(",
"hostname",
"string",
")",
"func",
"(",
"http",
".",
"ResponseWriter",
",",
"*",
"http",
".",
"Request",
")",
"{",
"return",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"l... | // activate the plugin and register it as a network driver. | [
"activate",
"the",
"plugin",
"and",
"register",
"it",
"as",
"a",
"network",
"driver",
"."
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/mgmtfn/dockplugin/dockplugin.go#L166-L178 |
7,817 | contiv/netplugin | mgmtfn/dockplugin/netDriver.go | GetDockerNetworkName | func GetDockerNetworkName(nwID string) (string, string, string, error) {
// first see if we can find the network in docknet oper state
dnetOper, err := docknet.FindDocknetByUUID(nwID)
if err == nil {
return dnetOper.TenantName, dnetOper.NetworkName, dnetOper.ServiceName, nil
}
if pluginMode == core.SwarmMode {
... | go | func GetDockerNetworkName(nwID string) (string, string, string, error) {
// first see if we can find the network in docknet oper state
dnetOper, err := docknet.FindDocknetByUUID(nwID)
if err == nil {
return dnetOper.TenantName, dnetOper.NetworkName, dnetOper.ServiceName, nil
}
if pluginMode == core.SwarmMode {
... | [
"func",
"GetDockerNetworkName",
"(",
"nwID",
"string",
")",
"(",
"string",
",",
"string",
",",
"string",
",",
"error",
")",
"{",
"// first see if we can find the network in docknet oper state",
"dnetOper",
",",
"err",
":=",
"docknet",
".",
"FindDocknetByUUID",
"(",
... | // GetDockerNetworkName gets network name from network UUID | [
"GetDockerNetworkName",
"gets",
"network",
"name",
"from",
"network",
"UUID"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/mgmtfn/dockplugin/netDriver.go#L534-L606 |
7,818 | contiv/netplugin | mgmtfn/dockplugin/netDriver.go | FindGroupFromTag | func FindGroupFromTag(epgTag string) (*mastercfg.EndpointGroupState, error) {
stateDriver, err := utils.GetStateDriver()
if err != nil {
return nil, err
}
epgCfg := &mastercfg.EndpointGroupState{}
epgCfg.StateDriver = stateDriver
epgList, err := epgCfg.ReadAll()
if err != nil {
return nil, err
}
var epg... | go | func FindGroupFromTag(epgTag string) (*mastercfg.EndpointGroupState, error) {
stateDriver, err := utils.GetStateDriver()
if err != nil {
return nil, err
}
epgCfg := &mastercfg.EndpointGroupState{}
epgCfg.StateDriver = stateDriver
epgList, err := epgCfg.ReadAll()
if err != nil {
return nil, err
}
var epg... | [
"func",
"FindGroupFromTag",
"(",
"epgTag",
"string",
")",
"(",
"*",
"mastercfg",
".",
"EndpointGroupState",
",",
"error",
")",
"{",
"stateDriver",
",",
"err",
":=",
"utils",
".",
"GetStateDriver",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
... | // FindGroupFromTag finds the group that has matching tag | [
"FindGroupFromTag",
"finds",
"the",
"group",
"that",
"has",
"matching",
"tag"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/mgmtfn/dockplugin/netDriver.go#L609-L636 |
7,819 | contiv/netplugin | mgmtfn/dockplugin/netDriver.go | FindNetworkFromTag | func FindNetworkFromTag(nwTag string) (*mastercfg.CfgNetworkState, error) {
stateDriver, err := utils.GetStateDriver()
if err != nil {
return nil, err
}
nwCfg := &mastercfg.CfgNetworkState{}
nwCfg.StateDriver = stateDriver
nwList, err := nwCfg.ReadAll()
if err != nil {
return nil, err
}
var nw *mastercfg.C... | go | func FindNetworkFromTag(nwTag string) (*mastercfg.CfgNetworkState, error) {
stateDriver, err := utils.GetStateDriver()
if err != nil {
return nil, err
}
nwCfg := &mastercfg.CfgNetworkState{}
nwCfg.StateDriver = stateDriver
nwList, err := nwCfg.ReadAll()
if err != nil {
return nil, err
}
var nw *mastercfg.C... | [
"func",
"FindNetworkFromTag",
"(",
"nwTag",
"string",
")",
"(",
"*",
"mastercfg",
".",
"CfgNetworkState",
",",
"error",
")",
"{",
"stateDriver",
",",
"err",
":=",
"utils",
".",
"GetStateDriver",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"n... | // FindNetworkFromTag finds the network that has matching tag | [
"FindNetworkFromTag",
"finds",
"the",
"network",
"that",
"has",
"matching",
"tag"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/mgmtfn/dockplugin/netDriver.go#L639-L663 |
7,820 | contiv/netplugin | mgmtfn/dockplugin/netDriver.go | createNetworkHelper | func createNetworkHelper(networkID string, tag string, IPv4Data, IPv6Data []driverapi.IPAMData) error {
var tenantName, networkName, serviceName string
var err error
if tag != "" {
// we need to map docker network to policy group or network using the tag
log.Infof("Received tag %s", tag)
var nw *mastercfg.CfgN... | go | func createNetworkHelper(networkID string, tag string, IPv4Data, IPv6Data []driverapi.IPAMData) error {
var tenantName, networkName, serviceName string
var err error
if tag != "" {
// we need to map docker network to policy group or network using the tag
log.Infof("Received tag %s", tag)
var nw *mastercfg.CfgN... | [
"func",
"createNetworkHelper",
"(",
"networkID",
"string",
",",
"tag",
"string",
",",
"IPv4Data",
",",
"IPv6Data",
"[",
"]",
"driverapi",
".",
"IPAMData",
")",
"error",
"{",
"var",
"tenantName",
",",
"networkName",
",",
"serviceName",
"string",
"\n",
"var",
... | // createNetworkHelper creates the association between docker network and contiv network
// if tag is given map docker net to epg or network, else create a contiv network | [
"createNetworkHelper",
"creates",
"the",
"association",
"between",
"docker",
"network",
"and",
"contiv",
"network",
"if",
"tag",
"is",
"given",
"map",
"docker",
"net",
"to",
"epg",
"or",
"network",
"else",
"create",
"a",
"contiv",
"network"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/mgmtfn/dockplugin/netDriver.go#L667-L744 |
7,821 | contiv/netplugin | mgmtfn/dockplugin/netDriver.go | deleteNetworkHelper | func deleteNetworkHelper(networkID string) error {
dnet, err := docknet.FindDocknetByUUID(networkID)
if err == nil {
// delete the dnet oper state
err = docknet.DeleteDockNetState(dnet.TenantName, dnet.NetworkName, dnet.ServiceName)
if err != nil {
msg := fmt.Sprintf("Could not delete docknet for nwID %s: %s... | go | func deleteNetworkHelper(networkID string) error {
dnet, err := docknet.FindDocknetByUUID(networkID)
if err == nil {
// delete the dnet oper state
err = docknet.DeleteDockNetState(dnet.TenantName, dnet.NetworkName, dnet.ServiceName)
if err != nil {
msg := fmt.Sprintf("Could not delete docknet for nwID %s: %s... | [
"func",
"deleteNetworkHelper",
"(",
"networkID",
"string",
")",
"error",
"{",
"dnet",
",",
"err",
":=",
"docknet",
".",
"FindDocknetByUUID",
"(",
"networkID",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"// delete the dnet oper state",
"err",
"=",
"docknet",
"."... | // deleteNetworkHelper removes the association between docker network
// and contiv network. We have to remove docker network state before
// remove network in contiv. | [
"deleteNetworkHelper",
"removes",
"the",
"association",
"between",
"docker",
"network",
"and",
"contiv",
"network",
".",
"We",
"have",
"to",
"remove",
"docker",
"network",
"state",
"before",
"remove",
"network",
"in",
"contiv",
"."
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/mgmtfn/dockplugin/netDriver.go#L749-L786 |
7,822 | contiv/netplugin | netplugin/agent/docker_event.go | handleDockerEvents | func (ag *Agent) handleDockerEvents(events <-chan events.Message, errs <-chan error) {
for {
select {
case err := <-errs:
if err != nil && err == io.EOF {
log.Errorf("Closing the events channel. Err: %+v", err)
return
}
if err != nil && err != io.EOF {
log.Errorf("Received error from docker e... | go | func (ag *Agent) handleDockerEvents(events <-chan events.Message, errs <-chan error) {
for {
select {
case err := <-errs:
if err != nil && err == io.EOF {
log.Errorf("Closing the events channel. Err: %+v", err)
return
}
if err != nil && err != io.EOF {
log.Errorf("Received error from docker e... | [
"func",
"(",
"ag",
"*",
"Agent",
")",
"handleDockerEvents",
"(",
"events",
"<-",
"chan",
"events",
".",
"Message",
",",
"errs",
"<-",
"chan",
"error",
")",
"{",
"for",
"{",
"select",
"{",
"case",
"err",
":=",
"<-",
"errs",
":",
"if",
"err",
"!=",
"... | // Handles docker events monitored by dockerclient. Currently we only handle
// container start and die event | [
"Handles",
"docker",
"events",
"monitored",
"by",
"dockerclient",
".",
"Currently",
"we",
"only",
"handle",
"container",
"start",
"and",
"die",
"event"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netplugin/agent/docker_event.go#L48-L131 |
7,823 | contiv/netplugin | netplugin/agent/docker_event.go | getLabelsFromContainerInspect | func getLabelsFromContainerInspect(containerInfo *types.ContainerJSON) map[string]string {
if containerInfo != nil && containerInfo.Config != nil {
return containerInfo.Config.Labels
}
return nil
} | go | func getLabelsFromContainerInspect(containerInfo *types.ContainerJSON) map[string]string {
if containerInfo != nil && containerInfo.Config != nil {
return containerInfo.Config.Labels
}
return nil
} | [
"func",
"getLabelsFromContainerInspect",
"(",
"containerInfo",
"*",
"types",
".",
"ContainerJSON",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"if",
"containerInfo",
"!=",
"nil",
"&&",
"containerInfo",
".",
"Config",
"!=",
"nil",
"{",
"return",
"containerInfo... | //getLabelsFromContainerInspect returns the labels associated with the container | [
"getLabelsFromContainerInspect",
"returns",
"the",
"labels",
"associated",
"with",
"the",
"container"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netplugin/agent/docker_event.go#L134-L139 |
7,824 | contiv/netplugin | netplugin/agent/docker_event.go | getTenantFromContainerInspect | func getTenantFromContainerInspect(containerInfo *types.ContainerJSON) string {
tenant := "default"
if containerInfo != nil && containerInfo.NetworkSettings != nil {
for network := range containerInfo.NetworkSettings.Networks {
if strings.Contains(network, "/") {
//network name is of the form networkname/ten... | go | func getTenantFromContainerInspect(containerInfo *types.ContainerJSON) string {
tenant := "default"
if containerInfo != nil && containerInfo.NetworkSettings != nil {
for network := range containerInfo.NetworkSettings.Networks {
if strings.Contains(network, "/") {
//network name is of the form networkname/ten... | [
"func",
"getTenantFromContainerInspect",
"(",
"containerInfo",
"*",
"types",
".",
"ContainerJSON",
")",
"string",
"{",
"tenant",
":=",
"\"",
"\"",
"\n",
"if",
"containerInfo",
"!=",
"nil",
"&&",
"containerInfo",
".",
"NetworkSettings",
"!=",
"nil",
"{",
"for",
... | //getTenantFromContainerInspect returns the tenant the container belongs to. | [
"getTenantFromContainerInspect",
"returns",
"the",
"tenant",
"the",
"container",
"belongs",
"to",
"."
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netplugin/agent/docker_event.go#L142-L153 |
7,825 | contiv/netplugin | drivers/vppd/vppdriver.go | Init | func (d *VppDriver) Init(info *core.InstanceInfo) error {
log.Infof("Initializing vppdriver")
return nil
} | go | func (d *VppDriver) Init(info *core.InstanceInfo) error {
log.Infof("Initializing vppdriver")
return nil
} | [
"func",
"(",
"d",
"*",
"VppDriver",
")",
"Init",
"(",
"info",
"*",
"core",
".",
"InstanceInfo",
")",
"error",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n\n",
"return",
"nil",
"\n",
"}"
] | // Init is not implemented. | [
"Init",
"is",
"not",
"implemented",
"."
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/drivers/vppd/vppdriver.go#L66-L70 |
7,826 | contiv/netplugin | drivers/vppd/vppdriver.go | DeleteEndpoint | func (d *VppDriver) DeleteEndpoint(id string) (err error) {
log.Infof("Not implemented")
return nil
} | go | func (d *VppDriver) DeleteEndpoint(id string) (err error) {
log.Infof("Not implemented")
return nil
} | [
"func",
"(",
"d",
"*",
"VppDriver",
")",
"DeleteEndpoint",
"(",
"id",
"string",
")",
"(",
"err",
"error",
")",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
"\n",
"}"
] | // DeleteEndpoint is not implemented. | [
"DeleteEndpoint",
"is",
"not",
"implemented",
"."
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/drivers/vppd/vppdriver.go#L103-L106 |
7,827 | contiv/netplugin | drivers/vppd/vppdriver.go | AddPeerHost | func (d *VppDriver) AddPeerHost(node core.ServiceInfo) error {
log.Infof("Not implemented")
return nil
} | go | func (d *VppDriver) AddPeerHost(node core.ServiceInfo) error {
log.Infof("Not implemented")
return nil
} | [
"func",
"(",
"d",
"*",
"VppDriver",
")",
"AddPeerHost",
"(",
"node",
"core",
".",
"ServiceInfo",
")",
"error",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
"\n",
"}"
] | // AddPeerHost is not implemented. | [
"AddPeerHost",
"is",
"not",
"implemented",
"."
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/drivers/vppd/vppdriver.go#L133-L136 |
7,828 | contiv/netplugin | drivers/vppd/vppdriver.go | GlobalConfigUpdate | func (d *VppDriver) GlobalConfigUpdate(inst core.InstanceInfo) error {
log.Infof("Not implemented")
return nil
} | go | func (d *VppDriver) GlobalConfigUpdate(inst core.InstanceInfo) error {
log.Infof("Not implemented")
return nil
} | [
"func",
"(",
"d",
"*",
"VppDriver",
")",
"GlobalConfigUpdate",
"(",
"inst",
"core",
".",
"InstanceInfo",
")",
"error",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
"\n",
"}"
] | // GlobalConfigUpdate is not implemented | [
"GlobalConfigUpdate",
"is",
"not",
"implemented"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/drivers/vppd/vppdriver.go#L203-L206 |
7,829 | contiv/netplugin | netmaster/master/api.go | ReleaseAddressHandler | func ReleaseAddressHandler(w http.ResponseWriter, r *http.Request, vars map[string]string) (interface{}, error) {
var relReq AddressReleaseRequest
var networkID string
var epgName string
var epgCfg *mastercfg.EndpointGroupState
// Get object from the request
err := json.NewDecoder(r.Body).Decode(&relReq)
if err... | go | func ReleaseAddressHandler(w http.ResponseWriter, r *http.Request, vars map[string]string) (interface{}, error) {
var relReq AddressReleaseRequest
var networkID string
var epgName string
var epgCfg *mastercfg.EndpointGroupState
// Get object from the request
err := json.NewDecoder(r.Body).Decode(&relReq)
if err... | [
"func",
"ReleaseAddressHandler",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"vars",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"var",
"relReq",
"AddressReleaseRe... | // ReleaseAddressHandler releases addresses | [
"ReleaseAddressHandler",
"releases",
"addresses"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netmaster/master/api.go#L275-L323 |
7,830 | contiv/netplugin | netmaster/master/api.go | CreateEndpointHandler | func CreateEndpointHandler(w http.ResponseWriter, r *http.Request, vars map[string]string) (interface{}, error) {
var epReq CreateEndpointRequest
// Get object from the request
err := json.NewDecoder(r.Body).Decode(&epReq)
if err != nil {
log.Errorf("Error decoding AllocAddressHandler. Err %v", err)
return nil... | go | func CreateEndpointHandler(w http.ResponseWriter, r *http.Request, vars map[string]string) (interface{}, error) {
var epReq CreateEndpointRequest
// Get object from the request
err := json.NewDecoder(r.Body).Decode(&epReq)
if err != nil {
log.Errorf("Error decoding AllocAddressHandler. Err %v", err)
return nil... | [
"func",
"CreateEndpointHandler",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"vars",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"var",
"epReq",
"CreateEndpointReq... | // CreateEndpointHandler handles create endpoint requests | [
"CreateEndpointHandler",
"handles",
"create",
"endpoint",
"requests"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netmaster/master/api.go#L326-L371 |
7,831 | contiv/netplugin | netmaster/master/api.go | DeleteEndpointHandler | func DeleteEndpointHandler(w http.ResponseWriter, r *http.Request, vars map[string]string) (interface{}, error) {
var epdelReq DeleteEndpointRequest
// Get object from the request
err := json.NewDecoder(r.Body).Decode(&epdelReq)
if err != nil {
log.Errorf("Error decoding AllocAddressHandler. Err %v", err)
retu... | go | func DeleteEndpointHandler(w http.ResponseWriter, r *http.Request, vars map[string]string) (interface{}, error) {
var epdelReq DeleteEndpointRequest
// Get object from the request
err := json.NewDecoder(r.Body).Decode(&epdelReq)
if err != nil {
log.Errorf("Error decoding AllocAddressHandler. Err %v", err)
retu... | [
"func",
"DeleteEndpointHandler",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"vars",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"var",
"epdelReq",
"DeleteEndpoint... | // DeleteEndpointHandler handles delete endpoint requests | [
"DeleteEndpointHandler",
"handles",
"delete",
"endpoint",
"requests"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netmaster/master/api.go#L374-L414 |
7,832 | contiv/netplugin | mgmtfn/mesosplugin/cniserver.go | parseCniArgs | func (cniReq *cniServer) parseCniArgs(httpBody []byte) error {
if err := json.Unmarshal(httpBody, &cniReq.pluginArgs); err != nil {
return fmt.Errorf("failed to parse JSON req: %s", err.Error())
}
cniLog.Debugf("parsed ifname: %s, netns: %s, container-id: %s,"+
"tenant: %s, network-name: %s, network-group: %s"... | go | func (cniReq *cniServer) parseCniArgs(httpBody []byte) error {
if err := json.Unmarshal(httpBody, &cniReq.pluginArgs); err != nil {
return fmt.Errorf("failed to parse JSON req: %s", err.Error())
}
cniLog.Debugf("parsed ifname: %s, netns: %s, container-id: %s,"+
"tenant: %s, network-name: %s, network-group: %s"... | [
"func",
"(",
"cniReq",
"*",
"cniServer",
")",
"parseCniArgs",
"(",
"httpBody",
"[",
"]",
"byte",
")",
"error",
"{",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"httpBody",
",",
"&",
"cniReq",
".",
"pluginArgs",
")",
";",
"err",
"!=",
"nil",
"{"... | // parse & save labels | [
"parse",
"&",
"save",
"labels"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/mgmtfn/mesosplugin/cniserver.go#L95-L147 |
7,833 | contiv/netplugin | mgmtfn/mesosplugin/cniserver.go | InitPlugin | func InitPlugin(netPlugin *plugin.NetPlugin) {
cniLog = log.WithField("plugin", "mesos")
cniLog.Infof("starting Mesos CNI server")
router := mux.NewRouter()
// register handlers for cni plugin
subRtr := router.Headers("Content-Type", "application/json").Subrouter()
subRtr.HandleFunc(cniapi.MesosNwIntfAdd, httpW... | go | func InitPlugin(netPlugin *plugin.NetPlugin) {
cniLog = log.WithField("plugin", "mesos")
cniLog.Infof("starting Mesos CNI server")
router := mux.NewRouter()
// register handlers for cni plugin
subRtr := router.Headers("Content-Type", "application/json").Subrouter()
subRtr.HandleFunc(cniapi.MesosNwIntfAdd, httpW... | [
"func",
"InitPlugin",
"(",
"netPlugin",
"*",
"plugin",
".",
"NetPlugin",
")",
"{",
"cniLog",
"=",
"log",
".",
"WithField",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"cniLog",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n",
"router",
":=",
"mux",
".",
... | // InitPlugin registers REST endpoints to handle requests from Mesos CNI plugins | [
"InitPlugin",
"registers",
"REST",
"endpoints",
"to",
"handle",
"requests",
"from",
"Mesos",
"CNI",
"plugins"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/mgmtfn/mesosplugin/cniserver.go#L191-L221 |
7,834 | contiv/netplugin | objdb/objdb.go | RegisterPlugin | func RegisterPlugin(name string, plugin Plugin) error {
pluginMutex.Lock()
defer pluginMutex.Unlock()
pluginList[name] = plugin
return nil
} | go | func RegisterPlugin(name string, plugin Plugin) error {
pluginMutex.Lock()
defer pluginMutex.Unlock()
pluginList[name] = plugin
return nil
} | [
"func",
"RegisterPlugin",
"(",
"name",
"string",
",",
"plugin",
"Plugin",
")",
"error",
"{",
"pluginMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"pluginMutex",
".",
"Unlock",
"(",
")",
"\n",
"pluginList",
"[",
"name",
"]",
"=",
"plugin",
"\n\n",
"return... | // RegisterPlugin Register a plugin | [
"RegisterPlugin",
"Register",
"a",
"plugin"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/objdb/objdb.go#L121-L127 |
7,835 | contiv/netplugin | objdb/objdb.go | GetPlugin | func GetPlugin(name string) Plugin {
// Find the conf store
pluginMutex.Lock()
defer pluginMutex.Unlock()
if pluginList[name] == nil {
log.Errorf("Objdb Plugin %s not registered", name)
return nil
}
return pluginList[name]
} | go | func GetPlugin(name string) Plugin {
// Find the conf store
pluginMutex.Lock()
defer pluginMutex.Unlock()
if pluginList[name] == nil {
log.Errorf("Objdb Plugin %s not registered", name)
return nil
}
return pluginList[name]
} | [
"func",
"GetPlugin",
"(",
"name",
"string",
")",
"Plugin",
"{",
"// Find the conf store",
"pluginMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"pluginMutex",
".",
"Unlock",
"(",
")",
"\n",
"if",
"pluginList",
"[",
"name",
"]",
"==",
"nil",
"{",
"log",
".... | // GetPlugin returns the plugin by name | [
"GetPlugin",
"returns",
"the",
"plugin",
"by",
"name"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/objdb/objdb.go#L130-L140 |
7,836 | contiv/netplugin | objdb/client.go | InitClient | func InitClient(storeName string, storeURLs []string) (API, error) {
plugin := GetPlugin(storeName)
if plugin == nil {
log.Errorf("Invalid DB type %s", storeName)
return nil, errors.New("unsupported DB type")
}
cl, err := plugin.NewClient(storeURLs)
if err != nil {
log.Errorf("Error creating client %s to url... | go | func InitClient(storeName string, storeURLs []string) (API, error) {
plugin := GetPlugin(storeName)
if plugin == nil {
log.Errorf("Invalid DB type %s", storeName)
return nil, errors.New("unsupported DB type")
}
cl, err := plugin.NewClient(storeURLs)
if err != nil {
log.Errorf("Error creating client %s to url... | [
"func",
"InitClient",
"(",
"storeName",
"string",
",",
"storeURLs",
"[",
"]",
"string",
")",
"(",
"API",
",",
"error",
")",
"{",
"plugin",
":=",
"GetPlugin",
"(",
"storeName",
")",
"\n",
"if",
"plugin",
"==",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\... | // InitClient aims to support multi endpoints | [
"InitClient",
"aims",
"to",
"support",
"multi",
"endpoints"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/objdb/client.go#L28-L40 |
7,837 | contiv/netplugin | objdb/client.go | NewClient | func NewClient(dbURL string) (API, error) {
// check if we should use default db
if dbURL == "" {
dbURL = defaultDbURL
}
parts := strings.Split(dbURL, "://")
if len(parts) < 2 {
log.Errorf("Invalid DB URL format %s", dbURL)
return nil, errors.New("invalid DB URL")
}
clientName := parts[0]
clientURL := pa... | go | func NewClient(dbURL string) (API, error) {
// check if we should use default db
if dbURL == "" {
dbURL = defaultDbURL
}
parts := strings.Split(dbURL, "://")
if len(parts) < 2 {
log.Errorf("Invalid DB URL format %s", dbURL)
return nil, errors.New("invalid DB URL")
}
clientName := parts[0]
clientURL := pa... | [
"func",
"NewClient",
"(",
"dbURL",
"string",
")",
"(",
"API",
",",
"error",
")",
"{",
"// check if we should use default db",
"if",
"dbURL",
"==",
"\"",
"\"",
"{",
"dbURL",
"=",
"defaultDbURL",
"\n",
"}",
"\n\n",
"parts",
":=",
"strings",
".",
"Split",
"("... | // NewClient Create a new conf store | [
"NewClient",
"Create",
"a",
"new",
"conf",
"store"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/objdb/client.go#L43-L58 |
7,838 | contiv/netplugin | netmaster/docknet/docknet.go | GetDocknetName | func GetDocknetName(tenantName, networkName, epgName string) string {
netName := ""
// if epg is specified, always use that, else use nw
if epgName == "" {
netName = networkName
} else {
netName = epgName
}
// add tenant suffix if not the default tenant
if tenantName != defaultTenantName {
netName = netN... | go | func GetDocknetName(tenantName, networkName, epgName string) string {
netName := ""
// if epg is specified, always use that, else use nw
if epgName == "" {
netName = networkName
} else {
netName = epgName
}
// add tenant suffix if not the default tenant
if tenantName != defaultTenantName {
netName = netN... | [
"func",
"GetDocknetName",
"(",
"tenantName",
",",
"networkName",
",",
"epgName",
"string",
")",
"string",
"{",
"netName",
":=",
"\"",
"\"",
"\n",
"// if epg is specified, always use that, else use nw",
"if",
"epgName",
"==",
"\"",
"\"",
"{",
"netName",
"=",
"netwo... | // GetDocknetName trims default tenant from network name | [
"GetDocknetName",
"trims",
"default",
"tenant",
"from",
"network",
"name"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netmaster/docknet/docknet.go#L86-L102 |
7,839 | contiv/netplugin | netmaster/docknet/docknet.go | UpdateDockerV2PluginName | func UpdateDockerV2PluginName(netDriver string, ipamDriver string) {
log.Infof("docker v2plugin (%s) updated to %s and ipam (%s) updated to %s",
netDriverName, netDriver, ipamDriverName, ipamDriver)
netDriverName = netDriver
ipamDriverName = ipamDriver
} | go | func UpdateDockerV2PluginName(netDriver string, ipamDriver string) {
log.Infof("docker v2plugin (%s) updated to %s and ipam (%s) updated to %s",
netDriverName, netDriver, ipamDriverName, ipamDriver)
netDriverName = netDriver
ipamDriverName = ipamDriver
} | [
"func",
"UpdateDockerV2PluginName",
"(",
"netDriver",
"string",
",",
"ipamDriver",
"string",
")",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
",",
"netDriverName",
",",
"netDriver",
",",
"ipamDriverName",
",",
"ipamDriver",
")",
"\n",
"netDriverName",
"=",
"net... | // UpdateDockerV2PluginName update the docker v2 plugin name | [
"UpdateDockerV2PluginName",
"update",
"the",
"docker",
"v2",
"plugin",
"name"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netmaster/docknet/docknet.go#L105-L110 |
7,840 | contiv/netplugin | netmaster/docknet/docknet.go | DeleteDockNet | func DeleteDockNet(tenantName, networkName, serviceName string) error {
// Trim default tenant name
docknetName := GetDocknetName(tenantName, networkName, serviceName)
// connect to docker
defaultHeaders := map[string]string{"User-Agent": "Docker-Client/" + dockerversion.Version + " (" + runtime.GOOS + ")"}
docke... | go | func DeleteDockNet(tenantName, networkName, serviceName string) error {
// Trim default tenant name
docknetName := GetDocknetName(tenantName, networkName, serviceName)
// connect to docker
defaultHeaders := map[string]string{"User-Agent": "Docker-Client/" + dockerversion.Version + " (" + runtime.GOOS + ")"}
docke... | [
"func",
"DeleteDockNet",
"(",
"tenantName",
",",
"networkName",
",",
"serviceName",
"string",
")",
"error",
"{",
"// Trim default tenant name",
"docknetName",
":=",
"GetDocknetName",
"(",
"tenantName",
",",
"networkName",
",",
"serviceName",
")",
"\n\n",
"// connect t... | // DeleteDockNet deletes a network in docker daemon | [
"DeleteDockNet",
"deletes",
"a",
"network",
"in",
"docker",
"daemon"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netmaster/docknet/docknet.go#L206-L244 |
7,841 | contiv/netplugin | netmaster/docknet/docknet.go | CreateDockNetState | func CreateDockNetState(tenantName, networkName, serviceName, docknetID string) error {
log.Infof("Adding DockNetState for %s.%s.%s --> %s", tenantName, networkName, serviceName, docknetID)
// Get the state driver
stateDriver, err := utils.GetStateDriver()
if err != nil {
log.Warnf("Couldn't get state driver for... | go | func CreateDockNetState(tenantName, networkName, serviceName, docknetID string) error {
log.Infof("Adding DockNetState for %s.%s.%s --> %s", tenantName, networkName, serviceName, docknetID)
// Get the state driver
stateDriver, err := utils.GetStateDriver()
if err != nil {
log.Warnf("Couldn't get state driver for... | [
"func",
"CreateDockNetState",
"(",
"tenantName",
",",
"networkName",
",",
"serviceName",
",",
"docknetID",
"string",
")",
"error",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
",",
"tenantName",
",",
"networkName",
",",
"serviceName",
",",
"docknetID",
")",
"\... | // CreateDockNetState creates an entry in the docknet state store | [
"CreateDockNetState",
"creates",
"an",
"entry",
"in",
"the",
"docknet",
"state",
"store"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netmaster/docknet/docknet.go#L247-L269 |
7,842 | contiv/netplugin | netmaster/docknet/docknet.go | DeleteDockNetState | func DeleteDockNetState(tenantName, networkName, serviceName string) error {
log.Infof("Deleting DockNetState for %s.%s.%s", tenantName, networkName, serviceName)
// Get the state driver
stateDriver, err := utils.GetStateDriver()
if err != nil {
log.Warnf("Couldn't get state driver for docknet del %v", err)
re... | go | func DeleteDockNetState(tenantName, networkName, serviceName string) error {
log.Infof("Deleting DockNetState for %s.%s.%s", tenantName, networkName, serviceName)
// Get the state driver
stateDriver, err := utils.GetStateDriver()
if err != nil {
log.Warnf("Couldn't get state driver for docknet del %v", err)
re... | [
"func",
"DeleteDockNetState",
"(",
"tenantName",
",",
"networkName",
",",
"serviceName",
"string",
")",
"error",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
",",
"tenantName",
",",
"networkName",
",",
"serviceName",
")",
"\n\n",
"// Get the state driver",
"stateD... | // DeleteDockNetState delete the docknet entry from state store | [
"DeleteDockNetState",
"delete",
"the",
"docknet",
"entry",
"from",
"state",
"store"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netmaster/docknet/docknet.go#L272-L289 |
7,843 | contiv/netplugin | netmaster/docknet/docknet.go | GetDocknetState | func GetDocknetState(tenantName, networkName, serviceName string) (*DnetOperState, error) {
log.Infof("GetDocknetState for %s.%s.%s", tenantName, networkName, serviceName)
// Get the state driver
stateDriver, err := utils.GetStateDriver()
if err != nil {
log.Warnf("Couldn't get state driver for docknet %v", err)... | go | func GetDocknetState(tenantName, networkName, serviceName string) (*DnetOperState, error) {
log.Infof("GetDocknetState for %s.%s.%s", tenantName, networkName, serviceName)
// Get the state driver
stateDriver, err := utils.GetStateDriver()
if err != nil {
log.Warnf("Couldn't get state driver for docknet %v", err)... | [
"func",
"GetDocknetState",
"(",
"tenantName",
",",
"networkName",
",",
"serviceName",
"string",
")",
"(",
"*",
"DnetOperState",
",",
"error",
")",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
",",
"tenantName",
",",
"networkName",
",",
"serviceName",
")",
"\... | // GetDocknetState gets the docknet entry from state store | [
"GetDocknetState",
"gets",
"the",
"docknet",
"entry",
"from",
"state",
"store"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netmaster/docknet/docknet.go#L292-L313 |
7,844 | contiv/netplugin | netmaster/docknet/docknet.go | FindDocknetByUUID | func FindDocknetByUUID(dnetID string) (*DnetOperState, error) {
log.Infof("find docker network '%s' ", dnetID)
// Get the state driver
stateDriver, err := utils.GetStateDriver()
if err != nil {
log.Warnf("Couldn't read global config %v", err)
return nil, err
}
tmpDnet := DnetOperState{}
tmpDnet.StateDriver... | go | func FindDocknetByUUID(dnetID string) (*DnetOperState, error) {
log.Infof("find docker network '%s' ", dnetID)
// Get the state driver
stateDriver, err := utils.GetStateDriver()
if err != nil {
log.Warnf("Couldn't read global config %v", err)
return nil, err
}
tmpDnet := DnetOperState{}
tmpDnet.StateDriver... | [
"func",
"FindDocknetByUUID",
"(",
"dnetID",
"string",
")",
"(",
"*",
"DnetOperState",
",",
"error",
")",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
",",
"dnetID",
")",
"\n\n",
"// Get the state driver",
"stateDriver",
",",
"err",
":=",
"utils",
".",
"GetSt... | // FindDocknetByUUID find the docknet by UUID | [
"FindDocknetByUUID",
"find",
"the",
"docknet",
"by",
"UUID"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netmaster/docknet/docknet.go#L316-L342 |
7,845 | contiv/netplugin | utils/k8sutils/k8sutils.go | GetK8SConfig | func GetK8SConfig(pCfg *ContivConfig) error {
bytes, err := ioutil.ReadFile(contivKubeCfgFile)
if err != nil {
return err
}
pCfg.SvcSubnet = defSvcSubnet
err = json.Unmarshal(bytes, pCfg)
if err != nil {
return fmt.Errorf("Error parsing config file: %s", err)
}
// If no client certs or token is specified,... | go | func GetK8SConfig(pCfg *ContivConfig) error {
bytes, err := ioutil.ReadFile(contivKubeCfgFile)
if err != nil {
return err
}
pCfg.SvcSubnet = defSvcSubnet
err = json.Unmarshal(bytes, pCfg)
if err != nil {
return fmt.Errorf("Error parsing config file: %s", err)
}
// If no client certs or token is specified,... | [
"func",
"GetK8SConfig",
"(",
"pCfg",
"*",
"ContivConfig",
")",
"error",
"{",
"bytes",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"contivKubeCfgFile",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"pCfg",
".",
"Svc... | // GetK8SConfig reads and parses the contivKubeCfgFile | [
"GetK8SConfig",
"reads",
"and",
"parses",
"the",
"contivKubeCfgFile"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/utils/k8sutils/k8sutils.go#L32-L54 |
7,846 | contiv/netplugin | utils/k8sutils/k8sutils.go | SetUpK8SClient | func SetUpK8SClient() (*kubernetes.Clientset, error) {
var contivK8sCfg ContivConfig
err := GetK8SConfig(&contivK8sCfg)
if err != nil {
log.Errorf("Failed to get K8S config: %v", err)
return nil, err
}
// init k8s client
restCfg := &k8sRest.Config{
Host: contivK8sCfg.K8sAPIServer,
BearerToken:... | go | func SetUpK8SClient() (*kubernetes.Clientset, error) {
var contivK8sCfg ContivConfig
err := GetK8SConfig(&contivK8sCfg)
if err != nil {
log.Errorf("Failed to get K8S config: %v", err)
return nil, err
}
// init k8s client
restCfg := &k8sRest.Config{
Host: contivK8sCfg.K8sAPIServer,
BearerToken:... | [
"func",
"SetUpK8SClient",
"(",
")",
"(",
"*",
"kubernetes",
".",
"Clientset",
",",
"error",
")",
"{",
"var",
"contivK8sCfg",
"ContivConfig",
"\n",
"err",
":=",
"GetK8SConfig",
"(",
"&",
"contivK8sCfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
"."... | // SetUpK8SClient init K8S client | [
"SetUpK8SClient",
"init",
"K8S",
"client"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/utils/k8sutils/k8sutils.go#L57-L78 |
7,847 | contiv/netplugin | utils/k8sutils/k8sutils.go | getDefaultToken | func getDefaultToken() (string, error) {
bytes, err := ioutil.ReadFile(tokenFile)
if err != nil {
log.Errorf("Failed: %v", err)
return "", err
}
return string(bytes), nil
} | go | func getDefaultToken() (string, error) {
bytes, err := ioutil.ReadFile(tokenFile)
if err != nil {
log.Errorf("Failed: %v", err)
return "", err
}
return string(bytes), nil
} | [
"func",
"getDefaultToken",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"bytes",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"tokenFile",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
... | // getDefaultToken gets the token to access kubernetes API Server
// from the secrets loaded on the container | [
"getDefaultToken",
"gets",
"the",
"token",
"to",
"access",
"kubernetes",
"API",
"Server",
"from",
"the",
"secrets",
"loaded",
"on",
"the",
"container"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/utils/k8sutils/k8sutils.go#L82-L89 |
7,848 | contiv/netplugin | netmaster/master/network.go | CreateNetworks | func CreateNetworks(stateDriver core.StateDriver, tenant *intent.ConfigTenant) error {
// Validate the config
err := validateNetworkConfig(tenant)
if err != nil {
log.Errorf("error validating network config. Error: %s", err)
return err
}
for _, network := range tenant.Networks {
err = CreateNetwork(network,... | go | func CreateNetworks(stateDriver core.StateDriver, tenant *intent.ConfigTenant) error {
// Validate the config
err := validateNetworkConfig(tenant)
if err != nil {
log.Errorf("error validating network config. Error: %s", err)
return err
}
for _, network := range tenant.Networks {
err = CreateNetwork(network,... | [
"func",
"CreateNetworks",
"(",
"stateDriver",
"core",
".",
"StateDriver",
",",
"tenant",
"*",
"intent",
".",
"ConfigTenant",
")",
"error",
"{",
"// Validate the config",
"err",
":=",
"validateNetworkConfig",
"(",
"tenant",
")",
"\n",
"if",
"err",
"!=",
"nil",
... | // CreateNetworks creates the necessary virtual networks for the tenant
// provided by ConfigTenant. | [
"CreateNetworks",
"creates",
"the",
"necessary",
"virtual",
"networks",
"for",
"the",
"tenant",
"provided",
"by",
"ConfigTenant",
"."
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netmaster/master/network.go#L207-L224 |
7,849 | contiv/netplugin | netmaster/master/network.go | DeleteNetworkID | func DeleteNetworkID(stateDriver core.StateDriver, netID string) error {
nwCfg := &mastercfg.CfgNetworkState{}
nwCfg.StateDriver = stateDriver
err := nwCfg.Read(netID)
if err != nil {
log.Errorf("network %s is not operational", netID)
return err
}
// Will Skip docker network deletion for ACI fabric mode.
ac... | go | func DeleteNetworkID(stateDriver core.StateDriver, netID string) error {
nwCfg := &mastercfg.CfgNetworkState{}
nwCfg.StateDriver = stateDriver
err := nwCfg.Read(netID)
if err != nil {
log.Errorf("network %s is not operational", netID)
return err
}
// Will Skip docker network deletion for ACI fabric mode.
ac... | [
"func",
"DeleteNetworkID",
"(",
"stateDriver",
"core",
".",
"StateDriver",
",",
"netID",
"string",
")",
"error",
"{",
"nwCfg",
":=",
"&",
"mastercfg",
".",
"CfgNetworkState",
"{",
"}",
"\n",
"nwCfg",
".",
"StateDriver",
"=",
"stateDriver",
"\n",
"err",
":=",... | // DeleteNetworkID removes a network by ID. | [
"DeleteNetworkID",
"removes",
"a",
"network",
"by",
"ID",
"."
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netmaster/master/network.go#L248-L305 |
7,850 | contiv/netplugin | netmaster/master/network.go | DeleteNetworks | func DeleteNetworks(stateDriver core.StateDriver, tenant *intent.ConfigTenant) error {
gCfg := &gstate.Cfg{}
gCfg.StateDriver = stateDriver
err := gCfg.Read("")
if err != nil {
log.Errorf("error reading tenant state. Error: %s", err)
return err
}
err = validateNetworkConfig(tenant)
if err != nil {
log.Er... | go | func DeleteNetworks(stateDriver core.StateDriver, tenant *intent.ConfigTenant) error {
gCfg := &gstate.Cfg{}
gCfg.StateDriver = stateDriver
err := gCfg.Read("")
if err != nil {
log.Errorf("error reading tenant state. Error: %s", err)
return err
}
err = validateNetworkConfig(tenant)
if err != nil {
log.Er... | [
"func",
"DeleteNetworks",
"(",
"stateDriver",
"core",
".",
"StateDriver",
",",
"tenant",
"*",
"intent",
".",
"ConfigTenant",
")",
"error",
"{",
"gCfg",
":=",
"&",
"gstate",
".",
"Cfg",
"{",
"}",
"\n",
"gCfg",
".",
"StateDriver",
"=",
"stateDriver",
"\n\n",... | // DeleteNetworks removes all the virtual networks for a given tenant. | [
"DeleteNetworks",
"removes",
"all",
"the",
"virtual",
"networks",
"for",
"a",
"given",
"tenant",
"."
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netmaster/master/network.go#L308-L333 |
7,851 | contiv/netplugin | netmaster/master/network.go | networkReleaseAddress | func networkReleaseAddress(nwCfg *mastercfg.CfgNetworkState, epgCfg *mastercfg.EndpointGroupState, ipAddress string) error {
isIPv6 := netutils.IsIPv6(ipAddress)
if isIPv6 {
hostID, err := netutils.GetIPv6HostID(nwCfg.SubnetIP, nwCfg.SubnetLen, ipAddress)
if err != nil {
log.Errorf("error getting host id from ... | go | func networkReleaseAddress(nwCfg *mastercfg.CfgNetworkState, epgCfg *mastercfg.EndpointGroupState, ipAddress string) error {
isIPv6 := netutils.IsIPv6(ipAddress)
if isIPv6 {
hostID, err := netutils.GetIPv6HostID(nwCfg.SubnetIP, nwCfg.SubnetLen, ipAddress)
if err != nil {
log.Errorf("error getting host id from ... | [
"func",
"networkReleaseAddress",
"(",
"nwCfg",
"*",
"mastercfg",
".",
"CfgNetworkState",
",",
"epgCfg",
"*",
"mastercfg",
".",
"EndpointGroupState",
",",
"ipAddress",
"string",
")",
"error",
"{",
"isIPv6",
":=",
"netutils",
".",
"IsIPv6",
"(",
"ipAddress",
")",
... | // networkReleaseAddress release the ip address | [
"networkReleaseAddress",
"release",
"the",
"ip",
"address"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netmaster/master/network.go#L464-L527 |
7,852 | contiv/netplugin | netplugin/cluster/cluster.go | addMaster | func addMaster(netplugin *plugin.NetPlugin, srvInfo objdb.ServiceInfo) error {
// save it in db
MasterDB[masterKey(srvInfo)] = &srvInfo
// tell the plugin about the master
return netplugin.AddMaster(core.ServiceInfo{
HostAddr: srvInfo.HostAddr,
Port: netmasterRPCPort,
})
} | go | func addMaster(netplugin *plugin.NetPlugin, srvInfo objdb.ServiceInfo) error {
// save it in db
MasterDB[masterKey(srvInfo)] = &srvInfo
// tell the plugin about the master
return netplugin.AddMaster(core.ServiceInfo{
HostAddr: srvInfo.HostAddr,
Port: netmasterRPCPort,
})
} | [
"func",
"addMaster",
"(",
"netplugin",
"*",
"plugin",
".",
"NetPlugin",
",",
"srvInfo",
"objdb",
".",
"ServiceInfo",
")",
"error",
"{",
"// save it in db",
"MasterDB",
"[",
"masterKey",
"(",
"srvInfo",
")",
"]",
"=",
"&",
"srvInfo",
"\n",
"// tell the plugin a... | // Add a master node | [
"Add",
"a",
"master",
"node"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netplugin/cluster/cluster.go#L52-L60 |
7,853 | contiv/netplugin | netplugin/cluster/cluster.go | deleteMaster | func deleteMaster(netplugin *plugin.NetPlugin, srvInfo objdb.ServiceInfo) error {
// delete from the db
delete(MasterDB, masterKey(srvInfo))
// tel plugin about it
return netplugin.DeleteMaster(core.ServiceInfo{
HostAddr: srvInfo.HostAddr,
Port: netmasterRPCPort,
})
} | go | func deleteMaster(netplugin *plugin.NetPlugin, srvInfo objdb.ServiceInfo) error {
// delete from the db
delete(MasterDB, masterKey(srvInfo))
// tel plugin about it
return netplugin.DeleteMaster(core.ServiceInfo{
HostAddr: srvInfo.HostAddr,
Port: netmasterRPCPort,
})
} | [
"func",
"deleteMaster",
"(",
"netplugin",
"*",
"plugin",
".",
"NetPlugin",
",",
"srvInfo",
"objdb",
".",
"ServiceInfo",
")",
"error",
"{",
"// delete from the db",
"delete",
"(",
"MasterDB",
",",
"masterKey",
"(",
"srvInfo",
")",
")",
"\n\n",
"// tel plugin abou... | // delete master node | [
"delete",
"master",
"node"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netplugin/cluster/cluster.go#L63-L72 |
7,854 | contiv/netplugin | netplugin/cluster/cluster.go | getMasterLockHolder | func getMasterLockHolder() (string, error) {
// Create the lock
leaderLock, err := ObjdbClient.NewLock("netmaster/leader", "", 0)
if err != nil {
log.Fatalf("Could not create leader lock. Err: %v", err)
}
// get current holder of leader lock
masterNode := leaderLock.GetHolder()
if masterNode == "" {
log.Err... | go | func getMasterLockHolder() (string, error) {
// Create the lock
leaderLock, err := ObjdbClient.NewLock("netmaster/leader", "", 0)
if err != nil {
log.Fatalf("Could not create leader lock. Err: %v", err)
}
// get current holder of leader lock
masterNode := leaderLock.GetHolder()
if masterNode == "" {
log.Err... | [
"func",
"getMasterLockHolder",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"// Create the lock",
"leaderLock",
",",
"err",
":=",
"ObjdbClient",
".",
"NewLock",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"0",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
... | // getMasterLockHolder returns the IP of current master lock hoder | [
"getMasterLockHolder",
"returns",
"the",
"IP",
"of",
"current",
"master",
"lock",
"hoder"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netplugin/cluster/cluster.go#L75-L90 |
7,855 | contiv/netplugin | netplugin/cluster/cluster.go | MasterPostReq | func MasterPostReq(path string, req interface{}, resp interface{}) error {
return masterReq(path, req, resp, false)
} | go | func MasterPostReq(path string, req interface{}, resp interface{}) error {
return masterReq(path, req, resp, false)
} | [
"func",
"MasterPostReq",
"(",
"path",
"string",
",",
"req",
"interface",
"{",
"}",
",",
"resp",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"masterReq",
"(",
"path",
",",
"req",
",",
"resp",
",",
"false",
")",
"\n",
"}"
] | // MasterPostReq makes a POST request to master node | [
"MasterPostReq",
"makes",
"a",
"POST",
"request",
"to",
"master",
"node"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netplugin/cluster/cluster.go#L161-L163 |
7,856 | contiv/netplugin | netplugin/cluster/cluster.go | registerService | func registerService(objClient objdb.API, ctrlIP, vtepIP, hostname string, vxlanUDPPort int) error {
// netplugin service info
srvInfo := objdb.ServiceInfo{
ServiceName: "netplugin",
TTL: 10,
HostAddr: ctrlIP,
Port: netpluginRPCPort1,
Hostname: hostname,
}
// Register the node with s... | go | func registerService(objClient objdb.API, ctrlIP, vtepIP, hostname string, vxlanUDPPort int) error {
// netplugin service info
srvInfo := objdb.ServiceInfo{
ServiceName: "netplugin",
TTL: 10,
HostAddr: ctrlIP,
Port: netpluginRPCPort1,
Hostname: hostname,
}
// Register the node with s... | [
"func",
"registerService",
"(",
"objClient",
"objdb",
".",
"API",
",",
"ctrlIP",
",",
"vtepIP",
",",
"hostname",
"string",
",",
"vxlanUDPPort",
"int",
")",
"error",
"{",
"// netplugin service info",
"srvInfo",
":=",
"objdb",
".",
"ServiceInfo",
"{",
"ServiceName... | // Register netplugin with service registry | [
"Register",
"netplugin",
"with",
"service",
"registry"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netplugin/cluster/cluster.go#L171-L221 |
7,857 | contiv/netplugin | netplugin/cluster/cluster.go | peerDiscoveryLoop | func peerDiscoveryLoop(netplugin *plugin.NetPlugin, objClient objdb.API, ctrlIP, vtepIP string) {
// Create channels for watch thread
nodeEventCh := make(chan objdb.WatchServiceEvent, 1)
watchStopCh := make(chan bool, 1)
masterEventCh := make(chan objdb.WatchServiceEvent, 1)
masterWatchStopCh := make(chan bool, 1)... | go | func peerDiscoveryLoop(netplugin *plugin.NetPlugin, objClient objdb.API, ctrlIP, vtepIP string) {
// Create channels for watch thread
nodeEventCh := make(chan objdb.WatchServiceEvent, 1)
watchStopCh := make(chan bool, 1)
masterEventCh := make(chan objdb.WatchServiceEvent, 1)
masterWatchStopCh := make(chan bool, 1)... | [
"func",
"peerDiscoveryLoop",
"(",
"netplugin",
"*",
"plugin",
".",
"NetPlugin",
",",
"objClient",
"objdb",
".",
"API",
",",
"ctrlIP",
",",
"vtepIP",
"string",
")",
"{",
"// Create channels for watch thread",
"nodeEventCh",
":=",
"make",
"(",
"chan",
"objdb",
"."... | // Main loop to discover peer hosts and masters | [
"Main",
"loop",
"to",
"discover",
"peer",
"hosts",
"and",
"masters"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netplugin/cluster/cluster.go#L224-L309 |
7,858 | contiv/netplugin | netplugin/cluster/cluster.go | Init | func Init(storeDriver string, storeURLs []string) error {
var err error
// Create an objdb client
ObjdbClient, err = objdb.InitClient(storeDriver, storeURLs)
return err
} | go | func Init(storeDriver string, storeURLs []string) error {
var err error
// Create an objdb client
ObjdbClient, err = objdb.InitClient(storeDriver, storeURLs)
return err
} | [
"func",
"Init",
"(",
"storeDriver",
"string",
",",
"storeURLs",
"[",
"]",
"string",
")",
"error",
"{",
"var",
"err",
"error",
"\n\n",
"// Create an objdb client",
"ObjdbClient",
",",
"err",
"=",
"objdb",
".",
"InitClient",
"(",
"storeDriver",
",",
"storeURLs",... | // Init initializes the cluster module | [
"Init",
"initializes",
"the",
"cluster",
"module"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netplugin/cluster/cluster.go#L312-L319 |
7,859 | contiv/netplugin | netplugin/cluster/cluster.go | RunLoop | func RunLoop(netplugin *plugin.NetPlugin, ctrlIP, vtepIP, hostname string) error {
// Register ourselves
err := registerService(ObjdbClient, ctrlIP, vtepIP, hostname, netplugin.PluginConfig.Instance.VxlanUDPPort)
// Start peer discovery loop
go peerDiscoveryLoop(netplugin, ObjdbClient, ctrlIP, vtepIP)
return err... | go | func RunLoop(netplugin *plugin.NetPlugin, ctrlIP, vtepIP, hostname string) error {
// Register ourselves
err := registerService(ObjdbClient, ctrlIP, vtepIP, hostname, netplugin.PluginConfig.Instance.VxlanUDPPort)
// Start peer discovery loop
go peerDiscoveryLoop(netplugin, ObjdbClient, ctrlIP, vtepIP)
return err... | [
"func",
"RunLoop",
"(",
"netplugin",
"*",
"plugin",
".",
"NetPlugin",
",",
"ctrlIP",
",",
"vtepIP",
",",
"hostname",
"string",
")",
"error",
"{",
"// Register ourselves",
"err",
":=",
"registerService",
"(",
"ObjdbClient",
",",
"ctrlIP",
",",
"vtepIP",
",",
... | // RunLoop registers netplugin service with cluster store and runs peer discovery | [
"RunLoop",
"registers",
"netplugin",
"service",
"with",
"cluster",
"store",
"and",
"runs",
"peer",
"discovery"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netplugin/cluster/cluster.go#L322-L330 |
7,860 | contiv/netplugin | contivmodel/contivModel.go | makeHttpHandler | func makeHttpHandler(handlerFunc HttpApiFunc) http.HandlerFunc {
// Create a closure and return an anonymous function
return func(w http.ResponseWriter, r *http.Request) {
// Call the handler
resp, err := handlerFunc(w, r, mux.Vars(r))
if err != nil {
// Log error
log.Errorf("Handler for %s %s returned er... | go | func makeHttpHandler(handlerFunc HttpApiFunc) http.HandlerFunc {
// Create a closure and return an anonymous function
return func(w http.ResponseWriter, r *http.Request) {
// Call the handler
resp, err := handlerFunc(w, r, mux.Vars(r))
if err != nil {
// Log error
log.Errorf("Handler for %s %s returned er... | [
"func",
"makeHttpHandler",
"(",
"handlerFunc",
"HttpApiFunc",
")",
"http",
".",
"HandlerFunc",
"{",
"// Create a closure and return an anonymous function",
"return",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
... | // Simple Wrapper for http handlers | [
"Simple",
"Wrapper",
"for",
"http",
"handlers"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L848-L867 |
7,861 | contiv/netplugin | contivmodel/contivModel.go | GetOperAciGw | func GetOperAciGw(obj *AciGwInspect) error {
// Check if we handle this object
if objCallbackHandler.AciGwCb == nil {
log.Errorf("No callback registered for aciGw object")
return errors.New("Invalid object type")
}
// Perform callback
err := objCallbackHandler.AciGwCb.AciGwGetOper(obj)
if err != nil {
log.... | go | func GetOperAciGw(obj *AciGwInspect) error {
// Check if we handle this object
if objCallbackHandler.AciGwCb == nil {
log.Errorf("No callback registered for aciGw object")
return errors.New("Invalid object type")
}
// Perform callback
err := objCallbackHandler.AciGwCb.AciGwGetOper(obj)
if err != nil {
log.... | [
"func",
"GetOperAciGw",
"(",
"obj",
"*",
"AciGwInspect",
")",
"error",
"{",
"// Check if we handle this object",
"if",
"objCallbackHandler",
".",
"AciGwCb",
"==",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"errors",
".",
"New",
"... | // Get a aciGwOper object | [
"Get",
"a",
"aciGwOper",
"object"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L1099-L1114 |
7,862 | contiv/netplugin | contivmodel/contivModel.go | CreateAciGw | func CreateAciGw(obj *AciGw) error {
// Validate parameters
err := ValidateAciGw(obj)
if err != nil {
log.Errorf("ValidateAciGw retruned error for: %+v. Err: %v", obj, err)
return err
}
// Check if we handle this object
if objCallbackHandler.AciGwCb == nil {
log.Errorf("No callback registered for aciGw obj... | go | func CreateAciGw(obj *AciGw) error {
// Validate parameters
err := ValidateAciGw(obj)
if err != nil {
log.Errorf("ValidateAciGw retruned error for: %+v. Err: %v", obj, err)
return err
}
// Check if we handle this object
if objCallbackHandler.AciGwCb == nil {
log.Errorf("No callback registered for aciGw obj... | [
"func",
"CreateAciGw",
"(",
"obj",
"*",
"AciGw",
")",
"error",
"{",
"// Validate parameters",
"err",
":=",
"ValidateAciGw",
"(",
"obj",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"obj",
",",
"err",
")",
"\n"... | // Create a aciGw object | [
"Create",
"a",
"aciGw",
"object"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L1195-L1255 |
7,863 | contiv/netplugin | contivmodel/contivModel.go | FindAciGw | func FindAciGw(key string) *AciGw {
collections.aciGwMutex.Lock()
defer collections.aciGwMutex.Unlock()
obj := collections.aciGws[key]
if obj == nil {
return nil
}
return obj
} | go | func FindAciGw(key string) *AciGw {
collections.aciGwMutex.Lock()
defer collections.aciGwMutex.Unlock()
obj := collections.aciGws[key]
if obj == nil {
return nil
}
return obj
} | [
"func",
"FindAciGw",
"(",
"key",
"string",
")",
"*",
"AciGw",
"{",
"collections",
".",
"aciGwMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"collections",
".",
"aciGwMutex",
".",
"Unlock",
"(",
")",
"\n\n",
"obj",
":=",
"collections",
".",
"aciGws",
"[",
... | // Return a pointer to aciGw from collection | [
"Return",
"a",
"pointer",
"to",
"aciGw",
"from",
"collection"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L1258-L1268 |
7,864 | contiv/netplugin | contivmodel/contivModel.go | DeleteAciGw | func DeleteAciGw(key string) error {
collections.aciGwMutex.Lock()
obj := collections.aciGws[key]
collections.aciGwMutex.Unlock()
if obj == nil {
log.Errorf("aciGw %s not found", key)
return errors.New("aciGw not found")
}
// Check if we handle this object
if objCallbackHandler.AciGwCb == nil {
log.Errorf... | go | func DeleteAciGw(key string) error {
collections.aciGwMutex.Lock()
obj := collections.aciGws[key]
collections.aciGwMutex.Unlock()
if obj == nil {
log.Errorf("aciGw %s not found", key)
return errors.New("aciGw not found")
}
// Check if we handle this object
if objCallbackHandler.AciGwCb == nil {
log.Errorf... | [
"func",
"DeleteAciGw",
"(",
"key",
"string",
")",
"error",
"{",
"collections",
".",
"aciGwMutex",
".",
"Lock",
"(",
")",
"\n",
"obj",
":=",
"collections",
".",
"aciGws",
"[",
"key",
"]",
"\n",
"collections",
".",
"aciGwMutex",
".",
"Unlock",
"(",
")",
... | // Delete a aciGw object | [
"Delete",
"a",
"aciGw",
"object"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L1271-L1307 |
7,865 | contiv/netplugin | contivmodel/contivModel.go | ValidateAciGw | func ValidateAciGw(obj *AciGw) error {
collections.aciGwMutex.Lock()
defer collections.aciGwMutex.Unlock()
// Validate key is correct
keyStr := obj.Name
if obj.Key != keyStr {
log.Errorf("Expecting AciGw Key: %s. Got: %s", keyStr, obj.Key)
return errors.New("Invalid Key")
}
// Validate each field
if len(... | go | func ValidateAciGw(obj *AciGw) error {
collections.aciGwMutex.Lock()
defer collections.aciGwMutex.Unlock()
// Validate key is correct
keyStr := obj.Name
if obj.Key != keyStr {
log.Errorf("Expecting AciGw Key: %s. Got: %s", keyStr, obj.Key)
return errors.New("Invalid Key")
}
// Validate each field
if len(... | [
"func",
"ValidateAciGw",
"(",
"obj",
"*",
"AciGw",
")",
"error",
"{",
"collections",
".",
"aciGwMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"collections",
".",
"aciGwMutex",
".",
"Unlock",
"(",
")",
"\n\n",
"// Validate key is correct",
"keyStr",
":=",
"ob... | // Validate a aciGw object | [
"Validate",
"a",
"aciGw",
"object"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L1370-L1438 |
7,866 | contiv/netplugin | contivmodel/contivModel.go | CreateAppProfile | func CreateAppProfile(obj *AppProfile) error {
// Validate parameters
err := ValidateAppProfile(obj)
if err != nil {
log.Errorf("ValidateAppProfile retruned error for: %+v. Err: %v", obj, err)
return err
}
// Check if we handle this object
if objCallbackHandler.AppProfileCb == nil {
log.Errorf("No callback... | go | func CreateAppProfile(obj *AppProfile) error {
// Validate parameters
err := ValidateAppProfile(obj)
if err != nil {
log.Errorf("ValidateAppProfile retruned error for: %+v. Err: %v", obj, err)
return err
}
// Check if we handle this object
if objCallbackHandler.AppProfileCb == nil {
log.Errorf("No callback... | [
"func",
"CreateAppProfile",
"(",
"obj",
"*",
"AppProfile",
")",
"error",
"{",
"// Validate parameters",
"err",
":=",
"ValidateAppProfile",
"(",
"obj",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"obj",
",",
"err"... | // Create a appProfile object | [
"Create",
"a",
"appProfile",
"object"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L1539-L1599 |
7,867 | contiv/netplugin | contivmodel/contivModel.go | FindAppProfile | func FindAppProfile(key string) *AppProfile {
collections.appProfileMutex.Lock()
defer collections.appProfileMutex.Unlock()
obj := collections.appProfiles[key]
if obj == nil {
return nil
}
return obj
} | go | func FindAppProfile(key string) *AppProfile {
collections.appProfileMutex.Lock()
defer collections.appProfileMutex.Unlock()
obj := collections.appProfiles[key]
if obj == nil {
return nil
}
return obj
} | [
"func",
"FindAppProfile",
"(",
"key",
"string",
")",
"*",
"AppProfile",
"{",
"collections",
".",
"appProfileMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"collections",
".",
"appProfileMutex",
".",
"Unlock",
"(",
")",
"\n\n",
"obj",
":=",
"collections",
".",... | // Return a pointer to appProfile from collection | [
"Return",
"a",
"pointer",
"to",
"appProfile",
"from",
"collection"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L1602-L1612 |
7,868 | contiv/netplugin | contivmodel/contivModel.go | DeleteAppProfile | func DeleteAppProfile(key string) error {
collections.appProfileMutex.Lock()
obj := collections.appProfiles[key]
collections.appProfileMutex.Unlock()
if obj == nil {
log.Errorf("appProfile %s not found", key)
return errors.New("appProfile not found")
}
// Check if we handle this object
if objCallbackHandler... | go | func DeleteAppProfile(key string) error {
collections.appProfileMutex.Lock()
obj := collections.appProfiles[key]
collections.appProfileMutex.Unlock()
if obj == nil {
log.Errorf("appProfile %s not found", key)
return errors.New("appProfile not found")
}
// Check if we handle this object
if objCallbackHandler... | [
"func",
"DeleteAppProfile",
"(",
"key",
"string",
")",
"error",
"{",
"collections",
".",
"appProfileMutex",
".",
"Lock",
"(",
")",
"\n",
"obj",
":=",
"collections",
".",
"appProfiles",
"[",
"key",
"]",
"\n",
"collections",
".",
"appProfileMutex",
".",
"Unloc... | // Delete a appProfile object | [
"Delete",
"a",
"appProfile",
"object"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L1615-L1651 |
7,869 | contiv/netplugin | contivmodel/contivModel.go | ValidateAppProfile | func ValidateAppProfile(obj *AppProfile) error {
collections.appProfileMutex.Lock()
defer collections.appProfileMutex.Unlock()
// Validate key is correct
keyStr := obj.TenantName + ":" + obj.AppProfileName
if obj.Key != keyStr {
log.Errorf("Expecting AppProfile Key: %s. Got: %s", keyStr, obj.Key)
return error... | go | func ValidateAppProfile(obj *AppProfile) error {
collections.appProfileMutex.Lock()
defer collections.appProfileMutex.Unlock()
// Validate key is correct
keyStr := obj.TenantName + ":" + obj.AppProfileName
if obj.Key != keyStr {
log.Errorf("Expecting AppProfile Key: %s. Got: %s", keyStr, obj.Key)
return error... | [
"func",
"ValidateAppProfile",
"(",
"obj",
"*",
"AppProfile",
")",
"error",
"{",
"collections",
".",
"appProfileMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"collections",
".",
"appProfileMutex",
".",
"Unlock",
"(",
")",
"\n\n",
"// Validate key is correct",
"ke... | // Validate a appProfile object | [
"Validate",
"a",
"appProfile",
"object"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L1714-L1746 |
7,870 | contiv/netplugin | contivmodel/contivModel.go | GetOperBgp | func GetOperBgp(obj *BgpInspect) error {
// Check if we handle this object
if objCallbackHandler.BgpCb == nil {
log.Errorf("No callback registered for Bgp object")
return errors.New("Invalid object type")
}
// Perform callback
err := objCallbackHandler.BgpCb.BgpGetOper(obj)
if err != nil {
log.Errorf("BgpD... | go | func GetOperBgp(obj *BgpInspect) error {
// Check if we handle this object
if objCallbackHandler.BgpCb == nil {
log.Errorf("No callback registered for Bgp object")
return errors.New("Invalid object type")
}
// Perform callback
err := objCallbackHandler.BgpCb.BgpGetOper(obj)
if err != nil {
log.Errorf("BgpD... | [
"func",
"GetOperBgp",
"(",
"obj",
"*",
"BgpInspect",
")",
"error",
"{",
"// Check if we handle this object",
"if",
"objCallbackHandler",
".",
"BgpCb",
"==",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"errors",
".",
"New",
"(",
... | // Get a BgpOper object | [
"Get",
"a",
"BgpOper",
"object"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L1774-L1789 |
7,871 | contiv/netplugin | contivmodel/contivModel.go | CreateBgp | func CreateBgp(obj *Bgp) error {
// Validate parameters
err := ValidateBgp(obj)
if err != nil {
log.Errorf("ValidateBgp retruned error for: %+v. Err: %v", obj, err)
return err
}
// Check if we handle this object
if objCallbackHandler.BgpCb == nil {
log.Errorf("No callback registered for Bgp object")
retu... | go | func CreateBgp(obj *Bgp) error {
// Validate parameters
err := ValidateBgp(obj)
if err != nil {
log.Errorf("ValidateBgp retruned error for: %+v. Err: %v", obj, err)
return err
}
// Check if we handle this object
if objCallbackHandler.BgpCb == nil {
log.Errorf("No callback registered for Bgp object")
retu... | [
"func",
"CreateBgp",
"(",
"obj",
"*",
"Bgp",
")",
"error",
"{",
"// Validate parameters",
"err",
":=",
"ValidateBgp",
"(",
"obj",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"obj",
",",
"err",
")",
"\n",
"r... | // Create a Bgp object | [
"Create",
"a",
"Bgp",
"object"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L1870-L1930 |
7,872 | contiv/netplugin | contivmodel/contivModel.go | FindBgp | func FindBgp(key string) *Bgp {
collections.BgpMutex.Lock()
defer collections.BgpMutex.Unlock()
obj := collections.Bgps[key]
if obj == nil {
return nil
}
return obj
} | go | func FindBgp(key string) *Bgp {
collections.BgpMutex.Lock()
defer collections.BgpMutex.Unlock()
obj := collections.Bgps[key]
if obj == nil {
return nil
}
return obj
} | [
"func",
"FindBgp",
"(",
"key",
"string",
")",
"*",
"Bgp",
"{",
"collections",
".",
"BgpMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"collections",
".",
"BgpMutex",
".",
"Unlock",
"(",
")",
"\n\n",
"obj",
":=",
"collections",
".",
"Bgps",
"[",
"key",
... | // Return a pointer to Bgp from collection | [
"Return",
"a",
"pointer",
"to",
"Bgp",
"from",
"collection"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L1933-L1943 |
7,873 | contiv/netplugin | contivmodel/contivModel.go | DeleteBgp | func DeleteBgp(key string) error {
collections.BgpMutex.Lock()
obj := collections.Bgps[key]
collections.BgpMutex.Unlock()
if obj == nil {
log.Errorf("Bgp %s not found", key)
return errors.New("Bgp not found")
}
// Check if we handle this object
if objCallbackHandler.BgpCb == nil {
log.Errorf("No callback ... | go | func DeleteBgp(key string) error {
collections.BgpMutex.Lock()
obj := collections.Bgps[key]
collections.BgpMutex.Unlock()
if obj == nil {
log.Errorf("Bgp %s not found", key)
return errors.New("Bgp not found")
}
// Check if we handle this object
if objCallbackHandler.BgpCb == nil {
log.Errorf("No callback ... | [
"func",
"DeleteBgp",
"(",
"key",
"string",
")",
"error",
"{",
"collections",
".",
"BgpMutex",
".",
"Lock",
"(",
")",
"\n",
"obj",
":=",
"collections",
".",
"Bgps",
"[",
"key",
"]",
"\n",
"collections",
".",
"BgpMutex",
".",
"Unlock",
"(",
")",
"\n",
... | // Delete a Bgp object | [
"Delete",
"a",
"Bgp",
"object"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L1946-L1982 |
7,874 | contiv/netplugin | contivmodel/contivModel.go | ValidateBgp | func ValidateBgp(obj *Bgp) error {
collections.BgpMutex.Lock()
defer collections.BgpMutex.Unlock()
// Validate key is correct
keyStr := obj.Hostname
if obj.Key != keyStr {
log.Errorf("Expecting Bgp Key: %s. Got: %s", keyStr, obj.Key)
return errors.New("Invalid Key")
}
// Validate each field
if len(obj.As... | go | func ValidateBgp(obj *Bgp) error {
collections.BgpMutex.Lock()
defer collections.BgpMutex.Unlock()
// Validate key is correct
keyStr := obj.Hostname
if obj.Key != keyStr {
log.Errorf("Expecting Bgp Key: %s. Got: %s", keyStr, obj.Key)
return errors.New("Invalid Key")
}
// Validate each field
if len(obj.As... | [
"func",
"ValidateBgp",
"(",
"obj",
"*",
"Bgp",
")",
"error",
"{",
"collections",
".",
"BgpMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"collections",
".",
"BgpMutex",
".",
"Unlock",
"(",
")",
"\n\n",
"// Validate key is correct",
"keyStr",
":=",
"obj",
".... | // Validate a Bgp object | [
"Validate",
"a",
"Bgp",
"object"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L2045-L2090 |
7,875 | contiv/netplugin | contivmodel/contivModel.go | GetOperEndpoint | func GetOperEndpoint(obj *EndpointInspect) error {
// Check if we handle this object
if objCallbackHandler.EndpointCb == nil {
log.Errorf("No callback registered for endpoint object")
return errors.New("Invalid object type")
}
// Perform callback
err := objCallbackHandler.EndpointCb.EndpointGetOper(obj)
if e... | go | func GetOperEndpoint(obj *EndpointInspect) error {
// Check if we handle this object
if objCallbackHandler.EndpointCb == nil {
log.Errorf("No callback registered for endpoint object")
return errors.New("Invalid object type")
}
// Perform callback
err := objCallbackHandler.EndpointCb.EndpointGetOper(obj)
if e... | [
"func",
"GetOperEndpoint",
"(",
"obj",
"*",
"EndpointInspect",
")",
"error",
"{",
"// Check if we handle this object",
"if",
"objCallbackHandler",
".",
"EndpointCb",
"==",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"errors",
".",
"... | // Get a endpointOper object | [
"Get",
"a",
"endpointOper",
"object"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L2109-L2124 |
7,876 | contiv/netplugin | contivmodel/contivModel.go | GetOperEndpointGroup | func GetOperEndpointGroup(obj *EndpointGroupInspect) error {
// Check if we handle this object
if objCallbackHandler.EndpointGroupCb == nil {
log.Errorf("No callback registered for endpointGroup object")
return errors.New("Invalid object type")
}
// Perform callback
err := objCallbackHandler.EndpointGroupCb.E... | go | func GetOperEndpointGroup(obj *EndpointGroupInspect) error {
// Check if we handle this object
if objCallbackHandler.EndpointGroupCb == nil {
log.Errorf("No callback registered for endpointGroup object")
return errors.New("Invalid object type")
}
// Perform callback
err := objCallbackHandler.EndpointGroupCb.E... | [
"func",
"GetOperEndpointGroup",
"(",
"obj",
"*",
"EndpointGroupInspect",
")",
"error",
"{",
"// Check if we handle this object",
"if",
"objCallbackHandler",
".",
"EndpointGroupCb",
"==",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"erro... | // Get a endpointGroupOper object | [
"Get",
"a",
"endpointGroupOper",
"object"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L2152-L2167 |
7,877 | contiv/netplugin | contivmodel/contivModel.go | CreateEndpointGroup | func CreateEndpointGroup(obj *EndpointGroup) error {
// Validate parameters
err := ValidateEndpointGroup(obj)
if err != nil {
log.Errorf("ValidateEndpointGroup retruned error for: %+v. Err: %v", obj, err)
return err
}
// Check if we handle this object
if objCallbackHandler.EndpointGroupCb == nil {
log.Erro... | go | func CreateEndpointGroup(obj *EndpointGroup) error {
// Validate parameters
err := ValidateEndpointGroup(obj)
if err != nil {
log.Errorf("ValidateEndpointGroup retruned error for: %+v. Err: %v", obj, err)
return err
}
// Check if we handle this object
if objCallbackHandler.EndpointGroupCb == nil {
log.Erro... | [
"func",
"CreateEndpointGroup",
"(",
"obj",
"*",
"EndpointGroup",
")",
"error",
"{",
"// Validate parameters",
"err",
":=",
"ValidateEndpointGroup",
"(",
"obj",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"obj",
","... | // Create a endpointGroup object | [
"Create",
"a",
"endpointGroup",
"object"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L2248-L2308 |
7,878 | contiv/netplugin | contivmodel/contivModel.go | FindEndpointGroup | func FindEndpointGroup(key string) *EndpointGroup {
collections.endpointGroupMutex.Lock()
defer collections.endpointGroupMutex.Unlock()
obj := collections.endpointGroups[key]
if obj == nil {
return nil
}
return obj
} | go | func FindEndpointGroup(key string) *EndpointGroup {
collections.endpointGroupMutex.Lock()
defer collections.endpointGroupMutex.Unlock()
obj := collections.endpointGroups[key]
if obj == nil {
return nil
}
return obj
} | [
"func",
"FindEndpointGroup",
"(",
"key",
"string",
")",
"*",
"EndpointGroup",
"{",
"collections",
".",
"endpointGroupMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"collections",
".",
"endpointGroupMutex",
".",
"Unlock",
"(",
")",
"\n\n",
"obj",
":=",
"collecti... | // Return a pointer to endpointGroup from collection | [
"Return",
"a",
"pointer",
"to",
"endpointGroup",
"from",
"collection"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L2311-L2321 |
7,879 | contiv/netplugin | contivmodel/contivModel.go | DeleteEndpointGroup | func DeleteEndpointGroup(key string) error {
collections.endpointGroupMutex.Lock()
obj := collections.endpointGroups[key]
collections.endpointGroupMutex.Unlock()
if obj == nil {
log.Errorf("endpointGroup %s not found", key)
return errors.New("endpointGroup not found")
}
// Check if we handle this object
if ... | go | func DeleteEndpointGroup(key string) error {
collections.endpointGroupMutex.Lock()
obj := collections.endpointGroups[key]
collections.endpointGroupMutex.Unlock()
if obj == nil {
log.Errorf("endpointGroup %s not found", key)
return errors.New("endpointGroup not found")
}
// Check if we handle this object
if ... | [
"func",
"DeleteEndpointGroup",
"(",
"key",
"string",
")",
"error",
"{",
"collections",
".",
"endpointGroupMutex",
".",
"Lock",
"(",
")",
"\n",
"obj",
":=",
"collections",
".",
"endpointGroups",
"[",
"key",
"]",
"\n",
"collections",
".",
"endpointGroupMutex",
"... | // Delete a endpointGroup object | [
"Delete",
"a",
"endpointGroup",
"object"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L2324-L2360 |
7,880 | contiv/netplugin | contivmodel/contivModel.go | ValidateEndpointGroup | func ValidateEndpointGroup(obj *EndpointGroup) error {
collections.endpointGroupMutex.Lock()
defer collections.endpointGroupMutex.Unlock()
// Validate key is correct
keyStr := obj.TenantName + ":" + obj.GroupName
if obj.Key != keyStr {
log.Errorf("Expecting EndpointGroup Key: %s. Got: %s", keyStr, obj.Key)
re... | go | func ValidateEndpointGroup(obj *EndpointGroup) error {
collections.endpointGroupMutex.Lock()
defer collections.endpointGroupMutex.Unlock()
// Validate key is correct
keyStr := obj.TenantName + ":" + obj.GroupName
if obj.Key != keyStr {
log.Errorf("Expecting EndpointGroup Key: %s. Got: %s", keyStr, obj.Key)
re... | [
"func",
"ValidateEndpointGroup",
"(",
"obj",
"*",
"EndpointGroup",
")",
"error",
"{",
"collections",
".",
"endpointGroupMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"collections",
".",
"endpointGroupMutex",
".",
"Unlock",
"(",
")",
"\n\n",
"// Validate key is cor... | // Validate a endpointGroup object | [
"Validate",
"a",
"endpointGroup",
"object"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L2423-L2482 |
7,881 | contiv/netplugin | contivmodel/contivModel.go | CreateExtContractsGroup | func CreateExtContractsGroup(obj *ExtContractsGroup) error {
// Validate parameters
err := ValidateExtContractsGroup(obj)
if err != nil {
log.Errorf("ValidateExtContractsGroup retruned error for: %+v. Err: %v", obj, err)
return err
}
// Check if we handle this object
if objCallbackHandler.ExtContractsGroupCb... | go | func CreateExtContractsGroup(obj *ExtContractsGroup) error {
// Validate parameters
err := ValidateExtContractsGroup(obj)
if err != nil {
log.Errorf("ValidateExtContractsGroup retruned error for: %+v. Err: %v", obj, err)
return err
}
// Check if we handle this object
if objCallbackHandler.ExtContractsGroupCb... | [
"func",
"CreateExtContractsGroup",
"(",
"obj",
"*",
"ExtContractsGroup",
")",
"error",
"{",
"// Validate parameters",
"err",
":=",
"ValidateExtContractsGroup",
"(",
"obj",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
... | // Create a extContractsGroup object | [
"Create",
"a",
"extContractsGroup",
"object"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L2583-L2643 |
7,882 | contiv/netplugin | contivmodel/contivModel.go | FindExtContractsGroup | func FindExtContractsGroup(key string) *ExtContractsGroup {
collections.extContractsGroupMutex.Lock()
defer collections.extContractsGroupMutex.Unlock()
obj := collections.extContractsGroups[key]
if obj == nil {
return nil
}
return obj
} | go | func FindExtContractsGroup(key string) *ExtContractsGroup {
collections.extContractsGroupMutex.Lock()
defer collections.extContractsGroupMutex.Unlock()
obj := collections.extContractsGroups[key]
if obj == nil {
return nil
}
return obj
} | [
"func",
"FindExtContractsGroup",
"(",
"key",
"string",
")",
"*",
"ExtContractsGroup",
"{",
"collections",
".",
"extContractsGroupMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"collections",
".",
"extContractsGroupMutex",
".",
"Unlock",
"(",
")",
"\n\n",
"obj",
"... | // Return a pointer to extContractsGroup from collection | [
"Return",
"a",
"pointer",
"to",
"extContractsGroup",
"from",
"collection"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L2646-L2656 |
7,883 | contiv/netplugin | contivmodel/contivModel.go | DeleteExtContractsGroup | func DeleteExtContractsGroup(key string) error {
collections.extContractsGroupMutex.Lock()
obj := collections.extContractsGroups[key]
collections.extContractsGroupMutex.Unlock()
if obj == nil {
log.Errorf("extContractsGroup %s not found", key)
return errors.New("extContractsGroup not found")
}
// Check if we... | go | func DeleteExtContractsGroup(key string) error {
collections.extContractsGroupMutex.Lock()
obj := collections.extContractsGroups[key]
collections.extContractsGroupMutex.Unlock()
if obj == nil {
log.Errorf("extContractsGroup %s not found", key)
return errors.New("extContractsGroup not found")
}
// Check if we... | [
"func",
"DeleteExtContractsGroup",
"(",
"key",
"string",
")",
"error",
"{",
"collections",
".",
"extContractsGroupMutex",
".",
"Lock",
"(",
")",
"\n",
"obj",
":=",
"collections",
".",
"extContractsGroups",
"[",
"key",
"]",
"\n",
"collections",
".",
"extContracts... | // Delete a extContractsGroup object | [
"Delete",
"a",
"extContractsGroup",
"object"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L2659-L2695 |
7,884 | contiv/netplugin | contivmodel/contivModel.go | ValidateExtContractsGroup | func ValidateExtContractsGroup(obj *ExtContractsGroup) error {
collections.extContractsGroupMutex.Lock()
defer collections.extContractsGroupMutex.Unlock()
// Validate key is correct
keyStr := obj.TenantName + ":" + obj.ContractsGroupName
if obj.Key != keyStr {
log.Errorf("Expecting ExtContractsGroup Key: %s. Go... | go | func ValidateExtContractsGroup(obj *ExtContractsGroup) error {
collections.extContractsGroupMutex.Lock()
defer collections.extContractsGroupMutex.Unlock()
// Validate key is correct
keyStr := obj.TenantName + ":" + obj.ContractsGroupName
if obj.Key != keyStr {
log.Errorf("Expecting ExtContractsGroup Key: %s. Go... | [
"func",
"ValidateExtContractsGroup",
"(",
"obj",
"*",
"ExtContractsGroup",
")",
"error",
"{",
"collections",
".",
"extContractsGroupMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"collections",
".",
"extContractsGroupMutex",
".",
"Unlock",
"(",
")",
"\n\n",
"// Val... | // Validate a extContractsGroup object | [
"Validate",
"a",
"extContractsGroup",
"object"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L2758-L2790 |
7,885 | contiv/netplugin | contivmodel/contivModel.go | GetOperGlobal | func GetOperGlobal(obj *GlobalInspect) error {
// Check if we handle this object
if objCallbackHandler.GlobalCb == nil {
log.Errorf("No callback registered for global object")
return errors.New("Invalid object type")
}
// Perform callback
err := objCallbackHandler.GlobalCb.GlobalGetOper(obj)
if err != nil {
... | go | func GetOperGlobal(obj *GlobalInspect) error {
// Check if we handle this object
if objCallbackHandler.GlobalCb == nil {
log.Errorf("No callback registered for global object")
return errors.New("Invalid object type")
}
// Perform callback
err := objCallbackHandler.GlobalCb.GlobalGetOper(obj)
if err != nil {
... | [
"func",
"GetOperGlobal",
"(",
"obj",
"*",
"GlobalInspect",
")",
"error",
"{",
"// Check if we handle this object",
"if",
"objCallbackHandler",
".",
"GlobalCb",
"==",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"errors",
".",
"New",
... | // Get a globalOper object | [
"Get",
"a",
"globalOper",
"object"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L2818-L2833 |
7,886 | contiv/netplugin | contivmodel/contivModel.go | CreateGlobal | func CreateGlobal(obj *Global) error {
// Validate parameters
err := ValidateGlobal(obj)
if err != nil {
log.Errorf("ValidateGlobal retruned error for: %+v. Err: %v", obj, err)
return err
}
// Check if we handle this object
if objCallbackHandler.GlobalCb == nil {
log.Errorf("No callback registered for glob... | go | func CreateGlobal(obj *Global) error {
// Validate parameters
err := ValidateGlobal(obj)
if err != nil {
log.Errorf("ValidateGlobal retruned error for: %+v. Err: %v", obj, err)
return err
}
// Check if we handle this object
if objCallbackHandler.GlobalCb == nil {
log.Errorf("No callback registered for glob... | [
"func",
"CreateGlobal",
"(",
"obj",
"*",
"Global",
")",
"error",
"{",
"// Validate parameters",
"err",
":=",
"ValidateGlobal",
"(",
"obj",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"obj",
",",
"err",
")",
"... | // Create a global object | [
"Create",
"a",
"global",
"object"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L2914-L2974 |
7,887 | contiv/netplugin | contivmodel/contivModel.go | FindGlobal | func FindGlobal(key string) *Global {
collections.globalMutex.Lock()
defer collections.globalMutex.Unlock()
obj := collections.globals[key]
if obj == nil {
return nil
}
return obj
} | go | func FindGlobal(key string) *Global {
collections.globalMutex.Lock()
defer collections.globalMutex.Unlock()
obj := collections.globals[key]
if obj == nil {
return nil
}
return obj
} | [
"func",
"FindGlobal",
"(",
"key",
"string",
")",
"*",
"Global",
"{",
"collections",
".",
"globalMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"collections",
".",
"globalMutex",
".",
"Unlock",
"(",
")",
"\n\n",
"obj",
":=",
"collections",
".",
"globals",
... | // Return a pointer to global from collection | [
"Return",
"a",
"pointer",
"to",
"global",
"from",
"collection"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L2977-L2987 |
7,888 | contiv/netplugin | contivmodel/contivModel.go | DeleteGlobal | func DeleteGlobal(key string) error {
collections.globalMutex.Lock()
obj := collections.globals[key]
collections.globalMutex.Unlock()
if obj == nil {
log.Errorf("global %s not found", key)
return errors.New("global not found")
}
// Check if we handle this object
if objCallbackHandler.GlobalCb == nil {
log... | go | func DeleteGlobal(key string) error {
collections.globalMutex.Lock()
obj := collections.globals[key]
collections.globalMutex.Unlock()
if obj == nil {
log.Errorf("global %s not found", key)
return errors.New("global not found")
}
// Check if we handle this object
if objCallbackHandler.GlobalCb == nil {
log... | [
"func",
"DeleteGlobal",
"(",
"key",
"string",
")",
"error",
"{",
"collections",
".",
"globalMutex",
".",
"Lock",
"(",
")",
"\n",
"obj",
":=",
"collections",
".",
"globals",
"[",
"key",
"]",
"\n",
"collections",
".",
"globalMutex",
".",
"Unlock",
"(",
")"... | // Delete a global object | [
"Delete",
"a",
"global",
"object"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L2990-L3026 |
7,889 | contiv/netplugin | contivmodel/contivModel.go | ValidateGlobal | func ValidateGlobal(obj *Global) error {
collections.globalMutex.Lock()
defer collections.globalMutex.Unlock()
// Validate key is correct
keyStr := obj.Name
if obj.Key != keyStr {
log.Errorf("Expecting Global Key: %s. Got: %s", keyStr, obj.Key)
return errors.New("Invalid Key")
}
// Validate each field
if... | go | func ValidateGlobal(obj *Global) error {
collections.globalMutex.Lock()
defer collections.globalMutex.Unlock()
// Validate key is correct
keyStr := obj.Name
if obj.Key != keyStr {
log.Errorf("Expecting Global Key: %s. Got: %s", keyStr, obj.Key)
return errors.New("Invalid Key")
}
// Validate each field
if... | [
"func",
"ValidateGlobal",
"(",
"obj",
"*",
"Global",
")",
"error",
"{",
"collections",
".",
"globalMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"collections",
".",
"globalMutex",
".",
"Unlock",
"(",
")",
"\n\n",
"// Validate key is correct",
"keyStr",
":=",
... | // Validate a global object | [
"Validate",
"a",
"global",
"object"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L3089-L3154 |
7,890 | contiv/netplugin | contivmodel/contivModel.go | CreateNetprofile | func CreateNetprofile(obj *Netprofile) error {
// Validate parameters
err := ValidateNetprofile(obj)
if err != nil {
log.Errorf("ValidateNetprofile retruned error for: %+v. Err: %v", obj, err)
return err
}
// Check if we handle this object
if objCallbackHandler.NetprofileCb == nil {
log.Errorf("No callback... | go | func CreateNetprofile(obj *Netprofile) error {
// Validate parameters
err := ValidateNetprofile(obj)
if err != nil {
log.Errorf("ValidateNetprofile retruned error for: %+v. Err: %v", obj, err)
return err
}
// Check if we handle this object
if objCallbackHandler.NetprofileCb == nil {
log.Errorf("No callback... | [
"func",
"CreateNetprofile",
"(",
"obj",
"*",
"Netprofile",
")",
"error",
"{",
"// Validate parameters",
"err",
":=",
"ValidateNetprofile",
"(",
"obj",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"obj",
",",
"err"... | // Create a netprofile object | [
"Create",
"a",
"netprofile",
"object"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L3255-L3315 |
7,891 | contiv/netplugin | contivmodel/contivModel.go | FindNetprofile | func FindNetprofile(key string) *Netprofile {
collections.netprofileMutex.Lock()
defer collections.netprofileMutex.Unlock()
obj := collections.netprofiles[key]
if obj == nil {
return nil
}
return obj
} | go | func FindNetprofile(key string) *Netprofile {
collections.netprofileMutex.Lock()
defer collections.netprofileMutex.Unlock()
obj := collections.netprofiles[key]
if obj == nil {
return nil
}
return obj
} | [
"func",
"FindNetprofile",
"(",
"key",
"string",
")",
"*",
"Netprofile",
"{",
"collections",
".",
"netprofileMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"collections",
".",
"netprofileMutex",
".",
"Unlock",
"(",
")",
"\n\n",
"obj",
":=",
"collections",
".",... | // Return a pointer to netprofile from collection | [
"Return",
"a",
"pointer",
"to",
"netprofile",
"from",
"collection"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L3318-L3328 |
7,892 | contiv/netplugin | contivmodel/contivModel.go | DeleteNetprofile | func DeleteNetprofile(key string) error {
collections.netprofileMutex.Lock()
obj := collections.netprofiles[key]
collections.netprofileMutex.Unlock()
if obj == nil {
log.Errorf("netprofile %s not found", key)
return errors.New("netprofile not found")
}
// Check if we handle this object
if objCallbackHandler... | go | func DeleteNetprofile(key string) error {
collections.netprofileMutex.Lock()
obj := collections.netprofiles[key]
collections.netprofileMutex.Unlock()
if obj == nil {
log.Errorf("netprofile %s not found", key)
return errors.New("netprofile not found")
}
// Check if we handle this object
if objCallbackHandler... | [
"func",
"DeleteNetprofile",
"(",
"key",
"string",
")",
"error",
"{",
"collections",
".",
"netprofileMutex",
".",
"Lock",
"(",
")",
"\n",
"obj",
":=",
"collections",
".",
"netprofiles",
"[",
"key",
"]",
"\n",
"collections",
".",
"netprofileMutex",
".",
"Unloc... | // Delete a netprofile object | [
"Delete",
"a",
"netprofile",
"object"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L3331-L3367 |
7,893 | contiv/netplugin | contivmodel/contivModel.go | ValidateNetprofile | func ValidateNetprofile(obj *Netprofile) error {
collections.netprofileMutex.Lock()
defer collections.netprofileMutex.Unlock()
// Validate key is correct
keyStr := obj.TenantName + ":" + obj.ProfileName
if obj.Key != keyStr {
log.Errorf("Expecting Netprofile Key: %s. Got: %s", keyStr, obj.Key)
return errors.N... | go | func ValidateNetprofile(obj *Netprofile) error {
collections.netprofileMutex.Lock()
defer collections.netprofileMutex.Unlock()
// Validate key is correct
keyStr := obj.TenantName + ":" + obj.ProfileName
if obj.Key != keyStr {
log.Errorf("Expecting Netprofile Key: %s. Got: %s", keyStr, obj.Key)
return errors.N... | [
"func",
"ValidateNetprofile",
"(",
"obj",
"*",
"Netprofile",
")",
"error",
"{",
"collections",
".",
"netprofileMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"collections",
".",
"netprofileMutex",
".",
"Unlock",
"(",
")",
"\n\n",
"// Validate key is correct",
"ke... | // Validate a netprofile object | [
"Validate",
"a",
"netprofile",
"object"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L3430-L3469 |
7,894 | contiv/netplugin | contivmodel/contivModel.go | GetOperNetwork | func GetOperNetwork(obj *NetworkInspect) error {
// Check if we handle this object
if objCallbackHandler.NetworkCb == nil {
log.Errorf("No callback registered for network object")
return errors.New("Invalid object type")
}
// Perform callback
err := objCallbackHandler.NetworkCb.NetworkGetOper(obj)
if err != ... | go | func GetOperNetwork(obj *NetworkInspect) error {
// Check if we handle this object
if objCallbackHandler.NetworkCb == nil {
log.Errorf("No callback registered for network object")
return errors.New("Invalid object type")
}
// Perform callback
err := objCallbackHandler.NetworkCb.NetworkGetOper(obj)
if err != ... | [
"func",
"GetOperNetwork",
"(",
"obj",
"*",
"NetworkInspect",
")",
"error",
"{",
"// Check if we handle this object",
"if",
"objCallbackHandler",
".",
"NetworkCb",
"==",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"errors",
".",
"New... | // Get a networkOper object | [
"Get",
"a",
"networkOper",
"object"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L3497-L3512 |
7,895 | contiv/netplugin | contivmodel/contivModel.go | CreateNetwork | func CreateNetwork(obj *Network) error {
// Validate parameters
err := ValidateNetwork(obj)
if err != nil {
log.Errorf("ValidateNetwork retruned error for: %+v. Err: %v", obj, err)
return err
}
// Check if we handle this object
if objCallbackHandler.NetworkCb == nil {
log.Errorf("No callback registered for... | go | func CreateNetwork(obj *Network) error {
// Validate parameters
err := ValidateNetwork(obj)
if err != nil {
log.Errorf("ValidateNetwork retruned error for: %+v. Err: %v", obj, err)
return err
}
// Check if we handle this object
if objCallbackHandler.NetworkCb == nil {
log.Errorf("No callback registered for... | [
"func",
"CreateNetwork",
"(",
"obj",
"*",
"Network",
")",
"error",
"{",
"// Validate parameters",
"err",
":=",
"ValidateNetwork",
"(",
"obj",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"obj",
",",
"err",
")",
... | // Create a network object | [
"Create",
"a",
"network",
"object"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L3593-L3653 |
7,896 | contiv/netplugin | contivmodel/contivModel.go | FindNetwork | func FindNetwork(key string) *Network {
collections.networkMutex.Lock()
defer collections.networkMutex.Unlock()
obj := collections.networks[key]
if obj == nil {
return nil
}
return obj
} | go | func FindNetwork(key string) *Network {
collections.networkMutex.Lock()
defer collections.networkMutex.Unlock()
obj := collections.networks[key]
if obj == nil {
return nil
}
return obj
} | [
"func",
"FindNetwork",
"(",
"key",
"string",
")",
"*",
"Network",
"{",
"collections",
".",
"networkMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"collections",
".",
"networkMutex",
".",
"Unlock",
"(",
")",
"\n\n",
"obj",
":=",
"collections",
".",
"networks... | // Return a pointer to network from collection | [
"Return",
"a",
"pointer",
"to",
"network",
"from",
"collection"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L3656-L3666 |
7,897 | contiv/netplugin | contivmodel/contivModel.go | DeleteNetwork | func DeleteNetwork(key string) error {
collections.networkMutex.Lock()
obj := collections.networks[key]
collections.networkMutex.Unlock()
if obj == nil {
log.Errorf("network %s not found", key)
return errors.New("network not found")
}
// Check if we handle this object
if objCallbackHandler.NetworkCb == nil ... | go | func DeleteNetwork(key string) error {
collections.networkMutex.Lock()
obj := collections.networks[key]
collections.networkMutex.Unlock()
if obj == nil {
log.Errorf("network %s not found", key)
return errors.New("network not found")
}
// Check if we handle this object
if objCallbackHandler.NetworkCb == nil ... | [
"func",
"DeleteNetwork",
"(",
"key",
"string",
")",
"error",
"{",
"collections",
".",
"networkMutex",
".",
"Lock",
"(",
")",
"\n",
"obj",
":=",
"collections",
".",
"networks",
"[",
"key",
"]",
"\n",
"collections",
".",
"networkMutex",
".",
"Unlock",
"(",
... | // Delete a network object | [
"Delete",
"a",
"network",
"object"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L3669-L3705 |
7,898 | contiv/netplugin | contivmodel/contivModel.go | ValidateNetwork | func ValidateNetwork(obj *Network) error {
collections.networkMutex.Lock()
defer collections.networkMutex.Unlock()
// Validate key is correct
keyStr := obj.TenantName + ":" + obj.NetworkName
if obj.Key != keyStr {
log.Errorf("Expecting Network Key: %s. Got: %s", keyStr, obj.Key)
return errors.New("Invalid Key... | go | func ValidateNetwork(obj *Network) error {
collections.networkMutex.Lock()
defer collections.networkMutex.Unlock()
// Validate key is correct
keyStr := obj.TenantName + ":" + obj.NetworkName
if obj.Key != keyStr {
log.Errorf("Expecting Network Key: %s. Got: %s", keyStr, obj.Key)
return errors.New("Invalid Key... | [
"func",
"ValidateNetwork",
"(",
"obj",
"*",
"Network",
")",
"error",
"{",
"collections",
".",
"networkMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"collections",
".",
"networkMutex",
".",
"Unlock",
"(",
")",
"\n\n",
"// Validate key is correct",
"keyStr",
":=... | // Validate a network object | [
"Validate",
"a",
"network",
"object"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L3768-L3847 |
7,899 | contiv/netplugin | contivmodel/contivModel.go | GetOperPolicy | func GetOperPolicy(obj *PolicyInspect) error {
// Check if we handle this object
if objCallbackHandler.PolicyCb == nil {
log.Errorf("No callback registered for policy object")
return errors.New("Invalid object type")
}
// Perform callback
err := objCallbackHandler.PolicyCb.PolicyGetOper(obj)
if err != nil {
... | go | func GetOperPolicy(obj *PolicyInspect) error {
// Check if we handle this object
if objCallbackHandler.PolicyCb == nil {
log.Errorf("No callback registered for policy object")
return errors.New("Invalid object type")
}
// Perform callback
err := objCallbackHandler.PolicyCb.PolicyGetOper(obj)
if err != nil {
... | [
"func",
"GetOperPolicy",
"(",
"obj",
"*",
"PolicyInspect",
")",
"error",
"{",
"// Check if we handle this object",
"if",
"objCallbackHandler",
".",
"PolicyCb",
"==",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"errors",
".",
"New",
... | // Get a policyOper object | [
"Get",
"a",
"policyOper",
"object"
] | 965773066d2b8ebed3514979949061a03d46fd20 | https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L3875-L3890 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.