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,900
contiv/netplugin
contivmodel/contivModel.go
CreatePolicy
func CreatePolicy(obj *Policy) error { // Validate parameters err := ValidatePolicy(obj) if err != nil { log.Errorf("ValidatePolicy retruned error for: %+v. Err: %v", obj, err) return err } // Check if we handle this object if objCallbackHandler.PolicyCb == nil { log.Errorf("No callback registered for poli...
go
func CreatePolicy(obj *Policy) error { // Validate parameters err := ValidatePolicy(obj) if err != nil { log.Errorf("ValidatePolicy retruned error for: %+v. Err: %v", obj, err) return err } // Check if we handle this object if objCallbackHandler.PolicyCb == nil { log.Errorf("No callback registered for poli...
[ "func", "CreatePolicy", "(", "obj", "*", "Policy", ")", "error", "{", "// Validate parameters", "err", ":=", "ValidatePolicy", "(", "obj", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Errorf", "(", "\"", "\"", ",", "obj", ",", "err", ")", "...
// Create a policy object
[ "Create", "a", "policy", "object" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L3971-L4031
7,901
contiv/netplugin
contivmodel/contivModel.go
FindPolicy
func FindPolicy(key string) *Policy { collections.policyMutex.Lock() defer collections.policyMutex.Unlock() obj := collections.policys[key] if obj == nil { return nil } return obj }
go
func FindPolicy(key string) *Policy { collections.policyMutex.Lock() defer collections.policyMutex.Unlock() obj := collections.policys[key] if obj == nil { return nil } return obj }
[ "func", "FindPolicy", "(", "key", "string", ")", "*", "Policy", "{", "collections", ".", "policyMutex", ".", "Lock", "(", ")", "\n", "defer", "collections", ".", "policyMutex", ".", "Unlock", "(", ")", "\n\n", "obj", ":=", "collections", ".", "policys", ...
// Return a pointer to policy from collection
[ "Return", "a", "pointer", "to", "policy", "from", "collection" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L4034-L4044
7,902
contiv/netplugin
contivmodel/contivModel.go
DeletePolicy
func DeletePolicy(key string) error { collections.policyMutex.Lock() obj := collections.policys[key] collections.policyMutex.Unlock() if obj == nil { log.Errorf("policy %s not found", key) return errors.New("policy not found") } // Check if we handle this object if objCallbackHandler.PolicyCb == nil { log...
go
func DeletePolicy(key string) error { collections.policyMutex.Lock() obj := collections.policys[key] collections.policyMutex.Unlock() if obj == nil { log.Errorf("policy %s not found", key) return errors.New("policy not found") } // Check if we handle this object if objCallbackHandler.PolicyCb == nil { log...
[ "func", "DeletePolicy", "(", "key", "string", ")", "error", "{", "collections", ".", "policyMutex", ".", "Lock", "(", ")", "\n", "obj", ":=", "collections", ".", "policys", "[", "key", "]", "\n", "collections", ".", "policyMutex", ".", "Unlock", "(", ")"...
// Delete a policy object
[ "Delete", "a", "policy", "object" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L4047-L4083
7,903
contiv/netplugin
contivmodel/contivModel.go
ValidatePolicy
func ValidatePolicy(obj *Policy) error { collections.policyMutex.Lock() defer collections.policyMutex.Unlock() // Validate key is correct keyStr := obj.TenantName + ":" + obj.PolicyName if obj.Key != keyStr { log.Errorf("Expecting Policy Key: %s. Got: %s", keyStr, obj.Key) return errors.New("Invalid Key") } ...
go
func ValidatePolicy(obj *Policy) error { collections.policyMutex.Lock() defer collections.policyMutex.Unlock() // Validate key is correct keyStr := obj.TenantName + ":" + obj.PolicyName if obj.Key != keyStr { log.Errorf("Expecting Policy Key: %s. Got: %s", keyStr, obj.Key) return errors.New("Invalid Key") } ...
[ "func", "ValidatePolicy", "(", "obj", "*", "Policy", ")", "error", "{", "collections", ".", "policyMutex", ".", "Lock", "(", ")", "\n", "defer", "collections", ".", "policyMutex", ".", "Unlock", "(", ")", "\n\n", "// Validate key is correct", "keyStr", ":=", ...
// Validate a policy object
[ "Validate", "a", "policy", "object" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L4146-L4178
7,904
contiv/netplugin
contivmodel/contivModel.go
CreateRule
func CreateRule(obj *Rule) error { // Validate parameters err := ValidateRule(obj) if err != nil { log.Errorf("ValidateRule retruned error for: %+v. Err: %v", obj, err) return err } // Check if we handle this object if objCallbackHandler.RuleCb == nil { log.Errorf("No callback registered for rule object") ...
go
func CreateRule(obj *Rule) error { // Validate parameters err := ValidateRule(obj) if err != nil { log.Errorf("ValidateRule retruned error for: %+v. Err: %v", obj, err) return err } // Check if we handle this object if objCallbackHandler.RuleCb == nil { log.Errorf("No callback registered for rule object") ...
[ "func", "CreateRule", "(", "obj", "*", "Rule", ")", "error", "{", "// Validate parameters", "err", ":=", "ValidateRule", "(", "obj", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Errorf", "(", "\"", "\"", ",", "obj", ",", "err", ")", "\n", ...
// Create a rule object
[ "Create", "a", "rule", "object" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L4279-L4339
7,905
contiv/netplugin
contivmodel/contivModel.go
FindRule
func FindRule(key string) *Rule { collections.ruleMutex.Lock() defer collections.ruleMutex.Unlock() obj := collections.rules[key] if obj == nil { return nil } return obj }
go
func FindRule(key string) *Rule { collections.ruleMutex.Lock() defer collections.ruleMutex.Unlock() obj := collections.rules[key] if obj == nil { return nil } return obj }
[ "func", "FindRule", "(", "key", "string", ")", "*", "Rule", "{", "collections", ".", "ruleMutex", ".", "Lock", "(", ")", "\n", "defer", "collections", ".", "ruleMutex", ".", "Unlock", "(", ")", "\n\n", "obj", ":=", "collections", ".", "rules", "[", "ke...
// Return a pointer to rule from collection
[ "Return", "a", "pointer", "to", "rule", "from", "collection" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L4342-L4352
7,906
contiv/netplugin
contivmodel/contivModel.go
DeleteRule
func DeleteRule(key string) error { collections.ruleMutex.Lock() obj := collections.rules[key] collections.ruleMutex.Unlock() if obj == nil { log.Errorf("rule %s not found", key) return errors.New("rule not found") } // Check if we handle this object if objCallbackHandler.RuleCb == nil { log.Errorf("No ca...
go
func DeleteRule(key string) error { collections.ruleMutex.Lock() obj := collections.rules[key] collections.ruleMutex.Unlock() if obj == nil { log.Errorf("rule %s not found", key) return errors.New("rule not found") } // Check if we handle this object if objCallbackHandler.RuleCb == nil { log.Errorf("No ca...
[ "func", "DeleteRule", "(", "key", "string", ")", "error", "{", "collections", ".", "ruleMutex", ".", "Lock", "(", ")", "\n", "obj", ":=", "collections", ".", "rules", "[", "key", "]", "\n", "collections", ".", "ruleMutex", ".", "Unlock", "(", ")", "\n"...
// Delete a rule object
[ "Delete", "a", "rule", "object" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L4355-L4391
7,907
contiv/netplugin
contivmodel/contivModel.go
ValidateRule
func ValidateRule(obj *Rule) error { collections.ruleMutex.Lock() defer collections.ruleMutex.Unlock() // Validate key is correct keyStr := obj.TenantName + ":" + obj.PolicyName + ":" + obj.RuleID if obj.Key != keyStr { log.Errorf("Expecting Rule Key: %s. Got: %s", keyStr, obj.Key) return errors.New("Invalid ...
go
func ValidateRule(obj *Rule) error { collections.ruleMutex.Lock() defer collections.ruleMutex.Unlock() // Validate key is correct keyStr := obj.TenantName + ":" + obj.PolicyName + ":" + obj.RuleID if obj.Key != keyStr { log.Errorf("Expecting Rule Key: %s. Got: %s", keyStr, obj.Key) return errors.New("Invalid ...
[ "func", "ValidateRule", "(", "obj", "*", "Rule", ")", "error", "{", "collections", ".", "ruleMutex", ".", "Lock", "(", ")", "\n", "defer", "collections", ".", "ruleMutex", ".", "Unlock", "(", ")", "\n\n", "// Validate key is correct", "keyStr", ":=", "obj", ...
// Validate a rule object
[ "Validate", "a", "rule", "object" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L4454-L4572
7,908
contiv/netplugin
contivmodel/contivModel.go
GetOperServiceLB
func GetOperServiceLB(obj *ServiceLBInspect) error { // Check if we handle this object if objCallbackHandler.ServiceLBCb == nil { log.Errorf("No callback registered for serviceLB object") return errors.New("Invalid object type") } // Perform callback err := objCallbackHandler.ServiceLBCb.ServiceLBGetOper(obj)...
go
func GetOperServiceLB(obj *ServiceLBInspect) error { // Check if we handle this object if objCallbackHandler.ServiceLBCb == nil { log.Errorf("No callback registered for serviceLB object") return errors.New("Invalid object type") } // Perform callback err := objCallbackHandler.ServiceLBCb.ServiceLBGetOper(obj)...
[ "func", "GetOperServiceLB", "(", "obj", "*", "ServiceLBInspect", ")", "error", "{", "// Check if we handle this object", "if", "objCallbackHandler", ".", "ServiceLBCb", "==", "nil", "{", "log", ".", "Errorf", "(", "\"", "\"", ")", "\n", "return", "errors", ".", ...
// Get a serviceLBOper object
[ "Get", "a", "serviceLBOper", "object" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L4600-L4615
7,909
contiv/netplugin
contivmodel/contivModel.go
CreateServiceLB
func CreateServiceLB(obj *ServiceLB) error { // Validate parameters err := ValidateServiceLB(obj) if err != nil { log.Errorf("ValidateServiceLB retruned error for: %+v. Err: %v", obj, err) return err } // Check if we handle this object if objCallbackHandler.ServiceLBCb == nil { log.Errorf("No callback regi...
go
func CreateServiceLB(obj *ServiceLB) error { // Validate parameters err := ValidateServiceLB(obj) if err != nil { log.Errorf("ValidateServiceLB retruned error for: %+v. Err: %v", obj, err) return err } // Check if we handle this object if objCallbackHandler.ServiceLBCb == nil { log.Errorf("No callback regi...
[ "func", "CreateServiceLB", "(", "obj", "*", "ServiceLB", ")", "error", "{", "// Validate parameters", "err", ":=", "ValidateServiceLB", "(", "obj", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Errorf", "(", "\"", "\"", ",", "obj", ",", "err", ...
// Create a serviceLB object
[ "Create", "a", "serviceLB", "object" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L4696-L4756
7,910
contiv/netplugin
contivmodel/contivModel.go
FindServiceLB
func FindServiceLB(key string) *ServiceLB { collections.serviceLBMutex.Lock() defer collections.serviceLBMutex.Unlock() obj := collections.serviceLBs[key] if obj == nil { return nil } return obj }
go
func FindServiceLB(key string) *ServiceLB { collections.serviceLBMutex.Lock() defer collections.serviceLBMutex.Unlock() obj := collections.serviceLBs[key] if obj == nil { return nil } return obj }
[ "func", "FindServiceLB", "(", "key", "string", ")", "*", "ServiceLB", "{", "collections", ".", "serviceLBMutex", ".", "Lock", "(", ")", "\n", "defer", "collections", ".", "serviceLBMutex", ".", "Unlock", "(", ")", "\n\n", "obj", ":=", "collections", ".", "...
// Return a pointer to serviceLB from collection
[ "Return", "a", "pointer", "to", "serviceLB", "from", "collection" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L4759-L4769
7,911
contiv/netplugin
contivmodel/contivModel.go
DeleteServiceLB
func DeleteServiceLB(key string) error { collections.serviceLBMutex.Lock() obj := collections.serviceLBs[key] collections.serviceLBMutex.Unlock() if obj == nil { log.Errorf("serviceLB %s not found", key) return errors.New("serviceLB not found") } // Check if we handle this object if objCallbackHandler.Servi...
go
func DeleteServiceLB(key string) error { collections.serviceLBMutex.Lock() obj := collections.serviceLBs[key] collections.serviceLBMutex.Unlock() if obj == nil { log.Errorf("serviceLB %s not found", key) return errors.New("serviceLB not found") } // Check if we handle this object if objCallbackHandler.Servi...
[ "func", "DeleteServiceLB", "(", "key", "string", ")", "error", "{", "collections", ".", "serviceLBMutex", ".", "Lock", "(", ")", "\n", "obj", ":=", "collections", ".", "serviceLBs", "[", "key", "]", "\n", "collections", ".", "serviceLBMutex", ".", "Unlock", ...
// Delete a serviceLB object
[ "Delete", "a", "serviceLB", "object" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L4772-L4808
7,912
contiv/netplugin
contivmodel/contivModel.go
ValidateServiceLB
func ValidateServiceLB(obj *ServiceLB) error { collections.serviceLBMutex.Lock() defer collections.serviceLBMutex.Unlock() // Validate key is correct keyStr := obj.TenantName + ":" + obj.ServiceName if obj.Key != keyStr { log.Errorf("Expecting ServiceLB Key: %s. Got: %s", keyStr, obj.Key) return errors.New("I...
go
func ValidateServiceLB(obj *ServiceLB) error { collections.serviceLBMutex.Lock() defer collections.serviceLBMutex.Unlock() // Validate key is correct keyStr := obj.TenantName + ":" + obj.ServiceName if obj.Key != keyStr { log.Errorf("Expecting ServiceLB Key: %s. Got: %s", keyStr, obj.Key) return errors.New("I...
[ "func", "ValidateServiceLB", "(", "obj", "*", "ServiceLB", ")", "error", "{", "collections", ".", "serviceLBMutex", ".", "Lock", "(", ")", "\n", "defer", "collections", ".", "serviceLBMutex", ".", "Unlock", "(", ")", "\n\n", "// Validate key is correct", "keyStr...
// Validate a serviceLB object
[ "Validate", "a", "serviceLB", "object" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L4871-L4921
7,913
contiv/netplugin
contivmodel/contivModel.go
GetOperTenant
func GetOperTenant(obj *TenantInspect) error { // Check if we handle this object if objCallbackHandler.TenantCb == nil { log.Errorf("No callback registered for tenant object") return errors.New("Invalid object type") } // Perform callback err := objCallbackHandler.TenantCb.TenantGetOper(obj) if err != nil { ...
go
func GetOperTenant(obj *TenantInspect) error { // Check if we handle this object if objCallbackHandler.TenantCb == nil { log.Errorf("No callback registered for tenant object") return errors.New("Invalid object type") } // Perform callback err := objCallbackHandler.TenantCb.TenantGetOper(obj) if err != nil { ...
[ "func", "GetOperTenant", "(", "obj", "*", "TenantInspect", ")", "error", "{", "// Check if we handle this object", "if", "objCallbackHandler", ".", "TenantCb", "==", "nil", "{", "log", ".", "Errorf", "(", "\"", "\"", ")", "\n", "return", "errors", ".", "New", ...
// Get a tenantOper object
[ "Get", "a", "tenantOper", "object" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L4949-L4964
7,914
contiv/netplugin
contivmodel/contivModel.go
CreateTenant
func CreateTenant(obj *Tenant) error { // Validate parameters err := ValidateTenant(obj) if err != nil { log.Errorf("ValidateTenant retruned error for: %+v. Err: %v", obj, err) return err } // Check if we handle this object if objCallbackHandler.TenantCb == nil { log.Errorf("No callback registered for tena...
go
func CreateTenant(obj *Tenant) error { // Validate parameters err := ValidateTenant(obj) if err != nil { log.Errorf("ValidateTenant retruned error for: %+v. Err: %v", obj, err) return err } // Check if we handle this object if objCallbackHandler.TenantCb == nil { log.Errorf("No callback registered for tena...
[ "func", "CreateTenant", "(", "obj", "*", "Tenant", ")", "error", "{", "// Validate parameters", "err", ":=", "ValidateTenant", "(", "obj", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Errorf", "(", "\"", "\"", ",", "obj", ",", "err", ")", "...
// Create a tenant object
[ "Create", "a", "tenant", "object" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L5045-L5105
7,915
contiv/netplugin
contivmodel/contivModel.go
FindTenant
func FindTenant(key string) *Tenant { collections.tenantMutex.Lock() defer collections.tenantMutex.Unlock() obj := collections.tenants[key] if obj == nil { return nil } return obj }
go
func FindTenant(key string) *Tenant { collections.tenantMutex.Lock() defer collections.tenantMutex.Unlock() obj := collections.tenants[key] if obj == nil { return nil } return obj }
[ "func", "FindTenant", "(", "key", "string", ")", "*", "Tenant", "{", "collections", ".", "tenantMutex", ".", "Lock", "(", ")", "\n", "defer", "collections", ".", "tenantMutex", ".", "Unlock", "(", ")", "\n\n", "obj", ":=", "collections", ".", "tenants", ...
// Return a pointer to tenant from collection
[ "Return", "a", "pointer", "to", "tenant", "from", "collection" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L5108-L5118
7,916
contiv/netplugin
contivmodel/contivModel.go
DeleteTenant
func DeleteTenant(key string) error { collections.tenantMutex.Lock() obj := collections.tenants[key] collections.tenantMutex.Unlock() if obj == nil { log.Errorf("tenant %s not found", key) return errors.New("tenant not found") } // Check if we handle this object if objCallbackHandler.TenantCb == nil { log...
go
func DeleteTenant(key string) error { collections.tenantMutex.Lock() obj := collections.tenants[key] collections.tenantMutex.Unlock() if obj == nil { log.Errorf("tenant %s not found", key) return errors.New("tenant not found") } // Check if we handle this object if objCallbackHandler.TenantCb == nil { log...
[ "func", "DeleteTenant", "(", "key", "string", ")", "error", "{", "collections", ".", "tenantMutex", ".", "Lock", "(", ")", "\n", "obj", ":=", "collections", ".", "tenants", "[", "key", "]", "\n", "collections", ".", "tenantMutex", ".", "Unlock", "(", ")"...
// Delete a tenant object
[ "Delete", "a", "tenant", "object" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L5121-L5157
7,917
contiv/netplugin
contivmodel/contivModel.go
ValidateTenant
func ValidateTenant(obj *Tenant) error { collections.tenantMutex.Lock() defer collections.tenantMutex.Unlock() // Validate key is correct keyStr := obj.TenantName if obj.Key != keyStr { log.Errorf("Expecting Tenant Key: %s. Got: %s", keyStr, obj.Key) return errors.New("Invalid Key") } // Validate each fiel...
go
func ValidateTenant(obj *Tenant) error { collections.tenantMutex.Lock() defer collections.tenantMutex.Unlock() // Validate key is correct keyStr := obj.TenantName if obj.Key != keyStr { log.Errorf("Expecting Tenant Key: %s. Got: %s", keyStr, obj.Key) return errors.New("Invalid Key") } // Validate each fiel...
[ "func", "ValidateTenant", "(", "obj", "*", "Tenant", ")", "error", "{", "collections", ".", "tenantMutex", ".", "Lock", "(", ")", "\n", "defer", "collections", ".", "tenantMutex", ".", "Unlock", "(", ")", "\n\n", "// Validate key is correct", "keyStr", ":=", ...
// Validate a tenant object
[ "Validate", "a", "tenant", "object" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L5220-L5252
7,918
contiv/netplugin
contivmodel/contivModel.go
CreateVolume
func CreateVolume(obj *Volume) error { // Validate parameters err := ValidateVolume(obj) if err != nil { log.Errorf("ValidateVolume retruned error for: %+v. Err: %v", obj, err) return err } // Check if we handle this object if objCallbackHandler.VolumeCb == nil { log.Errorf("No callback registered for volu...
go
func CreateVolume(obj *Volume) error { // Validate parameters err := ValidateVolume(obj) if err != nil { log.Errorf("ValidateVolume retruned error for: %+v. Err: %v", obj, err) return err } // Check if we handle this object if objCallbackHandler.VolumeCb == nil { log.Errorf("No callback registered for volu...
[ "func", "CreateVolume", "(", "obj", "*", "Volume", ")", "error", "{", "// Validate parameters", "err", ":=", "ValidateVolume", "(", "obj", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Errorf", "(", "\"", "\"", ",", "obj", ",", "err", ")", "...
// Create a volume object
[ "Create", "a", "volume", "object" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L5353-L5413
7,919
contiv/netplugin
contivmodel/contivModel.go
FindVolume
func FindVolume(key string) *Volume { collections.volumeMutex.Lock() defer collections.volumeMutex.Unlock() obj := collections.volumes[key] if obj == nil { return nil } return obj }
go
func FindVolume(key string) *Volume { collections.volumeMutex.Lock() defer collections.volumeMutex.Unlock() obj := collections.volumes[key] if obj == nil { return nil } return obj }
[ "func", "FindVolume", "(", "key", "string", ")", "*", "Volume", "{", "collections", ".", "volumeMutex", ".", "Lock", "(", ")", "\n", "defer", "collections", ".", "volumeMutex", ".", "Unlock", "(", ")", "\n\n", "obj", ":=", "collections", ".", "volumes", ...
// Return a pointer to volume from collection
[ "Return", "a", "pointer", "to", "volume", "from", "collection" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L5416-L5426
7,920
contiv/netplugin
contivmodel/contivModel.go
DeleteVolume
func DeleteVolume(key string) error { collections.volumeMutex.Lock() obj := collections.volumes[key] collections.volumeMutex.Unlock() if obj == nil { log.Errorf("volume %s not found", key) return errors.New("volume not found") } // Check if we handle this object if objCallbackHandler.VolumeCb == nil { log...
go
func DeleteVolume(key string) error { collections.volumeMutex.Lock() obj := collections.volumes[key] collections.volumeMutex.Unlock() if obj == nil { log.Errorf("volume %s not found", key) return errors.New("volume not found") } // Check if we handle this object if objCallbackHandler.VolumeCb == nil { log...
[ "func", "DeleteVolume", "(", "key", "string", ")", "error", "{", "collections", ".", "volumeMutex", ".", "Lock", "(", ")", "\n", "obj", ":=", "collections", ".", "volumes", "[", "key", "]", "\n", "collections", ".", "volumeMutex", ".", "Unlock", "(", ")"...
// Delete a volume object
[ "Delete", "a", "volume", "object" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L5429-L5465
7,921
contiv/netplugin
contivmodel/contivModel.go
ValidateVolume
func ValidateVolume(obj *Volume) error { collections.volumeMutex.Lock() defer collections.volumeMutex.Unlock() // Validate key is correct keyStr := obj.TenantName + ":" + obj.VolumeName if obj.Key != keyStr { log.Errorf("Expecting Volume Key: %s. Got: %s", keyStr, obj.Key) return errors.New("Invalid Key") } ...
go
func ValidateVolume(obj *Volume) error { collections.volumeMutex.Lock() defer collections.volumeMutex.Unlock() // Validate key is correct keyStr := obj.TenantName + ":" + obj.VolumeName if obj.Key != keyStr { log.Errorf("Expecting Volume Key: %s. Got: %s", keyStr, obj.Key) return errors.New("Invalid Key") } ...
[ "func", "ValidateVolume", "(", "obj", "*", "Volume", ")", "error", "{", "collections", ".", "volumeMutex", ".", "Lock", "(", ")", "\n", "defer", "collections", ".", "volumeMutex", ".", "Unlock", "(", ")", "\n\n", "// Validate key is correct", "keyStr", ":=", ...
// Validate a volume object
[ "Validate", "a", "volume", "object" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L5528-L5542
7,922
contiv/netplugin
contivmodel/contivModel.go
CreateVolumeProfile
func CreateVolumeProfile(obj *VolumeProfile) error { // Validate parameters err := ValidateVolumeProfile(obj) if err != nil { log.Errorf("ValidateVolumeProfile retruned error for: %+v. Err: %v", obj, err) return err } // Check if we handle this object if objCallbackHandler.VolumeProfileCb == nil { log.Erro...
go
func CreateVolumeProfile(obj *VolumeProfile) error { // Validate parameters err := ValidateVolumeProfile(obj) if err != nil { log.Errorf("ValidateVolumeProfile retruned error for: %+v. Err: %v", obj, err) return err } // Check if we handle this object if objCallbackHandler.VolumeProfileCb == nil { log.Erro...
[ "func", "CreateVolumeProfile", "(", "obj", "*", "VolumeProfile", ")", "error", "{", "// Validate parameters", "err", ":=", "ValidateVolumeProfile", "(", "obj", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Errorf", "(", "\"", "\"", ",", "obj", ","...
// Create a volumeProfile object
[ "Create", "a", "volumeProfile", "object" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L5643-L5703
7,923
contiv/netplugin
contivmodel/contivModel.go
FindVolumeProfile
func FindVolumeProfile(key string) *VolumeProfile { collections.volumeProfileMutex.Lock() defer collections.volumeProfileMutex.Unlock() obj := collections.volumeProfiles[key] if obj == nil { return nil } return obj }
go
func FindVolumeProfile(key string) *VolumeProfile { collections.volumeProfileMutex.Lock() defer collections.volumeProfileMutex.Unlock() obj := collections.volumeProfiles[key] if obj == nil { return nil } return obj }
[ "func", "FindVolumeProfile", "(", "key", "string", ")", "*", "VolumeProfile", "{", "collections", ".", "volumeProfileMutex", ".", "Lock", "(", ")", "\n", "defer", "collections", ".", "volumeProfileMutex", ".", "Unlock", "(", ")", "\n\n", "obj", ":=", "collecti...
// Return a pointer to volumeProfile from collection
[ "Return", "a", "pointer", "to", "volumeProfile", "from", "collection" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L5706-L5716
7,924
contiv/netplugin
contivmodel/contivModel.go
DeleteVolumeProfile
func DeleteVolumeProfile(key string) error { collections.volumeProfileMutex.Lock() obj := collections.volumeProfiles[key] collections.volumeProfileMutex.Unlock() if obj == nil { log.Errorf("volumeProfile %s not found", key) return errors.New("volumeProfile not found") } // Check if we handle this object if ...
go
func DeleteVolumeProfile(key string) error { collections.volumeProfileMutex.Lock() obj := collections.volumeProfiles[key] collections.volumeProfileMutex.Unlock() if obj == nil { log.Errorf("volumeProfile %s not found", key) return errors.New("volumeProfile not found") } // Check if we handle this object if ...
[ "func", "DeleteVolumeProfile", "(", "key", "string", ")", "error", "{", "collections", ".", "volumeProfileMutex", ".", "Lock", "(", ")", "\n", "obj", ":=", "collections", ".", "volumeProfiles", "[", "key", "]", "\n", "collections", ".", "volumeProfileMutex", "...
// Delete a volumeProfile object
[ "Delete", "a", "volumeProfile", "object" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L5719-L5755
7,925
contiv/netplugin
contivmodel/contivModel.go
ValidateVolumeProfile
func ValidateVolumeProfile(obj *VolumeProfile) error { collections.volumeProfileMutex.Lock() defer collections.volumeProfileMutex.Unlock() // Validate key is correct keyStr := obj.TenantName + ":" + obj.VolumeProfileName if obj.Key != keyStr { log.Errorf("Expecting VolumeProfile Key: %s. Got: %s", keyStr, obj.K...
go
func ValidateVolumeProfile(obj *VolumeProfile) error { collections.volumeProfileMutex.Lock() defer collections.volumeProfileMutex.Unlock() // Validate key is correct keyStr := obj.TenantName + ":" + obj.VolumeProfileName if obj.Key != keyStr { log.Errorf("Expecting VolumeProfile Key: %s. Got: %s", keyStr, obj.K...
[ "func", "ValidateVolumeProfile", "(", "obj", "*", "VolumeProfile", ")", "error", "{", "collections", ".", "volumeProfileMutex", ".", "Lock", "(", ")", "\n", "defer", "collections", ".", "volumeProfileMutex", ".", "Unlock", "(", ")", "\n\n", "// Validate key is cor...
// Validate a volumeProfile object
[ "Validate", "a", "volumeProfile", "object" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/contivmodel/contivModel.go#L5818-L5832
7,926
contiv/netplugin
netplugin/agent/agent.go
NewAgent
func NewAgent(pluginConfig *plugin.Config) *Agent { opts := pluginConfig.Instance netPlugin := &plugin.NetPlugin{} // init cluster state err := cluster.Init(pluginConfig.Drivers.State, []string{opts.DbURL}) if err != nil { log.Fatalf("Error initializing cluster. Err: %v", err) } // Init the driver plugins.. ...
go
func NewAgent(pluginConfig *plugin.Config) *Agent { opts := pluginConfig.Instance netPlugin := &plugin.NetPlugin{} // init cluster state err := cluster.Init(pluginConfig.Drivers.State, []string{opts.DbURL}) if err != nil { log.Fatalf("Error initializing cluster. Err: %v", err) } // Init the driver plugins.. ...
[ "func", "NewAgent", "(", "pluginConfig", "*", "plugin", ".", "Config", ")", "*", "Agent", "{", "opts", ":=", "pluginConfig", ".", "Instance", "\n", "netPlugin", ":=", "&", "plugin", ".", "NetPlugin", "{", "}", "\n\n", "// init cluster state", "err", ":=", ...
// NewAgent creates a new netplugin agent
[ "NewAgent", "creates", "a", "new", "netplugin", "agent" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netplugin/agent/agent.go#L48-L90
7,927
contiv/netplugin
netplugin/agent/agent.go
ProcessCurrentState
func (ag *Agent) ProcessCurrentState() error { opts := ag.pluginConfig.Instance readNet := &mastercfg.CfgNetworkState{} readNet.StateDriver = ag.netPlugin.StateDriver netCfgs, err := readNet.ReadAll() if err == nil { for idx, netCfg := range netCfgs { net := netCfg.(*mastercfg.CfgNetworkState) log.Debugf("...
go
func (ag *Agent) ProcessCurrentState() error { opts := ag.pluginConfig.Instance readNet := &mastercfg.CfgNetworkState{} readNet.StateDriver = ag.netPlugin.StateDriver netCfgs, err := readNet.ReadAll() if err == nil { for idx, netCfg := range netCfgs { net := netCfg.(*mastercfg.CfgNetworkState) log.Debugf("...
[ "func", "(", "ag", "*", "Agent", ")", "ProcessCurrentState", "(", ")", "error", "{", "opts", ":=", "ag", ".", "pluginConfig", ".", "Instance", "\n", "readNet", ":=", "&", "mastercfg", ".", "CfgNetworkState", "{", "}", "\n", "readNet", ".", "StateDriver", ...
// ProcessCurrentState processes current state as read from stateStore
[ "ProcessCurrentState", "processes", "current", "state", "as", "read", "from", "stateStore" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netplugin/agent/agent.go#L98-L172
7,928
contiv/netplugin
netplugin/agent/agent.go
PostInit
func (ag *Agent) PostInit() error { opts := ag.pluginConfig.Instance // Initialize clustering err := cluster.RunLoop(ag.netPlugin, opts.CtrlIP, opts.VtepIP, opts.HostLabel) if err != nil { log.Errorf("Error starting cluster run loop") } // start service REST requests ag.serveRequests() return nil }
go
func (ag *Agent) PostInit() error { opts := ag.pluginConfig.Instance // Initialize clustering err := cluster.RunLoop(ag.netPlugin, opts.CtrlIP, opts.VtepIP, opts.HostLabel) if err != nil { log.Errorf("Error starting cluster run loop") } // start service REST requests ag.serveRequests() return nil }
[ "func", "(", "ag", "*", "Agent", ")", "PostInit", "(", ")", "error", "{", "opts", ":=", "ag", ".", "pluginConfig", ".", "Instance", "\n\n", "// Initialize clustering", "err", ":=", "cluster", ".", "RunLoop", "(", "ag", ".", "netPlugin", ",", "opts", ".",...
// PostInit post initialization
[ "PostInit", "post", "initialization" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netplugin/agent/agent.go#L175-L188
7,929
contiv/netplugin
netplugin/agent/agent.go
HandleEvents
func (ag *Agent) HandleEvents() error { opts := ag.pluginConfig.Instance recvErr := make(chan error, 1) go handleNetworkEvents(ag.netPlugin, opts, recvErr) go handleBgpEvents(ag.netPlugin, opts, recvErr) go handleEndpointEvents(ag.netPlugin, opts, recvErr) go handleEpgEvents(ag.netPlugin, opts, recvErr) go ...
go
func (ag *Agent) HandleEvents() error { opts := ag.pluginConfig.Instance recvErr := make(chan error, 1) go handleNetworkEvents(ag.netPlugin, opts, recvErr) go handleBgpEvents(ag.netPlugin, opts, recvErr) go handleEndpointEvents(ag.netPlugin, opts, recvErr) go handleEpgEvents(ag.netPlugin, opts, recvErr) go ...
[ "func", "(", "ag", "*", "Agent", ")", "HandleEvents", "(", ")", "error", "{", "opts", ":=", "ag", ".", "pluginConfig", ".", "Instance", "\n", "recvErr", ":=", "make", "(", "chan", "error", ",", "1", ")", "\n\n", "go", "handleNetworkEvents", "(", "ag", ...
// HandleEvents handles events
[ "HandleEvents", "handles", "events" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netplugin/agent/agent.go#L207-L242
7,930
contiv/netplugin
netplugin/agent/agent.go
serveRequests
func (ag *Agent) serveRequests() { listenURL := ":9090" router := mux.NewRouter() // Add REST routes s := router.Methods("GET").Subrouter() s.HandleFunc("/svcstats", func(w http.ResponseWriter, r *http.Request) { stats, err := ag.netPlugin.GetEndpointStats() if err != nil { log.Errorf("Error fetching stats...
go
func (ag *Agent) serveRequests() { listenURL := ":9090" router := mux.NewRouter() // Add REST routes s := router.Methods("GET").Subrouter() s.HandleFunc("/svcstats", func(w http.ResponseWriter, r *http.Request) { stats, err := ag.netPlugin.GetEndpointStats() if err != nil { log.Errorf("Error fetching stats...
[ "func", "(", "ag", "*", "Agent", ")", "serveRequests", "(", ")", "{", "listenURL", ":=", "\"", "\"", "\n", "router", ":=", "mux", ".", "NewRouter", "(", ")", "\n\n", "// Add REST routes", "s", ":=", "router", ".", "Methods", "(", "\"", "\"", ")", "."...
// serveRequests serve REST api requests
[ "serveRequests", "serve", "REST", "api", "requests" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netplugin/agent/agent.go#L245-L304
7,931
contiv/netplugin
netplugin/agent/agent.go
ReclaimEndpointHandler
func (ag *Agent) ReclaimEndpointHandler(w http.ResponseWriter, r *http.Request, vars map[string]string) (interface{}, error) { epID := vars["id"] // delete the endpoint err := ag.netPlugin.DeleteEndpoint(epID) if err != nil { log.Errorf("Error deleting endpoint %v. Err: %v", epID, err) http.Error(w, fmt.Sprintf...
go
func (ag *Agent) ReclaimEndpointHandler(w http.ResponseWriter, r *http.Request, vars map[string]string) (interface{}, error) { epID := vars["id"] // delete the endpoint err := ag.netPlugin.DeleteEndpoint(epID) if err != nil { log.Errorf("Error deleting endpoint %v. Err: %v", epID, err) http.Error(w, fmt.Sprintf...
[ "func", "(", "ag", "*", "Agent", ")", "ReclaimEndpointHandler", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "vars", "map", "[", "string", "]", "string", ")", "(", "interface", "{", "}", ",", "error", ")", "{",...
// ReclaimEndpointHandler reclaims endpoint
[ "ReclaimEndpointHandler", "reclaims", "endpoint" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netplugin/agent/agent.go#L307-L318
7,932
contiv/netplugin
netctl/config.go
applyConfig
func applyConfig(cl *contivClient.ContivClient) error { data, err := ioutil.ReadFile(configPath()) if err != nil { return fmt.Errorf("failed to read config file: %v", err) } nc := Config{} if err := json.Unmarshal(data, &nc); err != nil { return fmt.Errorf("failed to unmarshal JSON: %v", err) } // add the ...
go
func applyConfig(cl *contivClient.ContivClient) error { data, err := ioutil.ReadFile(configPath()) if err != nil { return fmt.Errorf("failed to read config file: %v", err) } nc := Config{} if err := json.Unmarshal(data, &nc); err != nil { return fmt.Errorf("failed to unmarshal JSON: %v", err) } // add the ...
[ "func", "applyConfig", "(", "cl", "*", "contivClient", ".", "ContivClient", ")", "error", "{", "data", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "configPath", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", ...
// applyConfig applies the netctl config to the specified ContivClient
[ "applyConfig", "applies", "the", "netctl", "config", "to", "the", "specified", "ContivClient" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netctl/config.go#L24-L41
7,933
contiv/netplugin
netctl/config.go
configPath
func configPath() string { var homeDir string // this fails for static binaries usr, err := user.Current() if err == nil { homeDir = usr.HomeDir } // this should work where we don't have static binaries if err != nil { homeDir = os.Getenv("HOME") } // panic if we've failed to retrieve the home directory i...
go
func configPath() string { var homeDir string // this fails for static binaries usr, err := user.Current() if err == nil { homeDir = usr.HomeDir } // this should work where we don't have static binaries if err != nil { homeDir = os.Getenv("HOME") } // panic if we've failed to retrieve the home directory i...
[ "func", "configPath", "(", ")", "string", "{", "var", "homeDir", "string", "\n", "// this fails for static binaries", "usr", ",", "err", ":=", "user", ".", "Current", "(", ")", "\n", "if", "err", "==", "nil", "{", "homeDir", "=", "usr", ".", "HomeDir", "...
// configPath returns the full path to the user's netctl config file
[ "configPath", "returns", "the", "full", "path", "to", "the", "user", "s", "netctl", "config", "file" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netctl/config.go#L55-L72
7,934
contiv/netplugin
netctl/config.go
writeConfig
func writeConfig(ctx *cli.Context, data []byte) { dir := filepath.Dir(configPath()) // try to create the netctl config directory but ignore "already exists" errors. // only the user should be able to read the contents of this directory if err := os.Mkdir(dir, 0700); err != nil && !os.IsExist(err) { errExit(ctx, ...
go
func writeConfig(ctx *cli.Context, data []byte) { dir := filepath.Dir(configPath()) // try to create the netctl config directory but ignore "already exists" errors. // only the user should be able to read the contents of this directory if err := os.Mkdir(dir, 0700); err != nil && !os.IsExist(err) { errExit(ctx, ...
[ "func", "writeConfig", "(", "ctx", "*", "cli", ".", "Context", ",", "data", "[", "]", "byte", ")", "{", "dir", ":=", "filepath", ".", "Dir", "(", "configPath", "(", ")", ")", "\n\n", "// try to create the netctl config directory but ignore \"already exists\" error...
// writeConfig writes out the netctl config file, creating the directory and file as necessary
[ "writeConfig", "writes", "out", "the", "netctl", "config", "file", "creating", "the", "directory", "and", "file", "as", "necessary" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netctl/config.go#L75-L88
7,935
contiv/netplugin
utils/dockerutils.go
getDockerHost
func getDockerHost() string { dockerHost := os.Getenv("DOCKER_HOST") if dockerHost == "" { if runtime.GOOS == "windows" { // If we do not have a host, default to TCP socket on Windows dockerHost = fmt.Sprintf("tcp://%s:%d", DefaultHTTPHost, DefaultHTTPPort) } else { // If we do not have a host, default t...
go
func getDockerHost() string { dockerHost := os.Getenv("DOCKER_HOST") if dockerHost == "" { if runtime.GOOS == "windows" { // If we do not have a host, default to TCP socket on Windows dockerHost = fmt.Sprintf("tcp://%s:%d", DefaultHTTPHost, DefaultHTTPPort) } else { // If we do not have a host, default t...
[ "func", "getDockerHost", "(", ")", "string", "{", "dockerHost", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", "\n", "if", "dockerHost", "==", "\"", "\"", "{", "if", "runtime", ".", "GOOS", "==", "\"", "\"", "{", "// If we do not have a host, default to ...
// getDockerHost returns the docker socket based on Environment settings
[ "getDockerHost", "returns", "the", "docker", "socket", "based", "on", "Environment", "settings" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/utils/dockerutils.go#L21-L33
7,936
contiv/netplugin
netplugin/nameserver/nameserver.go
AddLbService
func (ens *NetpluginNameServer) AddLbService(tenant string, name string, v4name string) { if len(v4name) > 0 { dnsLog.Infof("add k8s service %s ip %s", name, v4name) if tenant == K8sDefaultTenant { ens.k8sService.Set(name, nameRecord{v4Record: net.ParseIP(v4name)}) } else { mc := mastercfg.CfgServiceLBStat...
go
func (ens *NetpluginNameServer) AddLbService(tenant string, name string, v4name string) { if len(v4name) > 0 { dnsLog.Infof("add k8s service %s ip %s", name, v4name) if tenant == K8sDefaultTenant { ens.k8sService.Set(name, nameRecord{v4Record: net.ParseIP(v4name)}) } else { mc := mastercfg.CfgServiceLBStat...
[ "func", "(", "ens", "*", "NetpluginNameServer", ")", "AddLbService", "(", "tenant", "string", ",", "name", "string", ",", "v4name", "string", ")", "{", "if", "len", "(", "v4name", ")", ">", "0", "{", "dnsLog", ".", "Infof", "(", "\"", "\"", ",", "nam...
// AddLbService adds a LB service in non-multi tenant record
[ "AddLbService", "adds", "a", "LB", "service", "in", "non", "-", "multi", "tenant", "record" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netplugin/nameserver/nameserver.go#L153-L167
7,937
contiv/netplugin
netplugin/nameserver/nameserver.go
DelLbService
func (ens *NetpluginNameServer) DelLbService(tenant string, name string) { dnsLog.Infof("delete k8s service %s ", name) if tenant == K8sDefaultTenant { ens.k8sService.Remove(name) } else { mc := mastercfg.CfgServiceLBState{ Tenant: tenant, ServiceName: name, } ens.delService(&mc) } }
go
func (ens *NetpluginNameServer) DelLbService(tenant string, name string) { dnsLog.Infof("delete k8s service %s ", name) if tenant == K8sDefaultTenant { ens.k8sService.Remove(name) } else { mc := mastercfg.CfgServiceLBState{ Tenant: tenant, ServiceName: name, } ens.delService(&mc) } }
[ "func", "(", "ens", "*", "NetpluginNameServer", ")", "DelLbService", "(", "tenant", "string", ",", "name", "string", ")", "{", "dnsLog", ".", "Infof", "(", "\"", "\"", ",", "name", ")", "\n", "if", "tenant", "==", "K8sDefaultTenant", "{", "ens", ".", "...
// DelLbService deletes LB service from non-multi tenant record
[ "DelLbService", "deletes", "LB", "service", "from", "non", "-", "multi", "tenant", "record" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netplugin/nameserver/nameserver.go#L170-L182
7,938
contiv/netplugin
netplugin/nameserver/nameserver.go
InspectState
func (ens *NetpluginNameServer) InspectState() (interface{}, error) { s := struct { SvcChan int `json:"serviceQueue"` EpChan int `json:"endpointQueue"` Dtbl map[string]map[string]map[string][]string `json:"dnsRecords"` Stats map...
go
func (ens *NetpluginNameServer) InspectState() (interface{}, error) { s := struct { SvcChan int `json:"serviceQueue"` EpChan int `json:"endpointQueue"` Dtbl map[string]map[string]map[string][]string `json:"dnsRecords"` Stats map...
[ "func", "(", "ens", "*", "NetpluginNameServer", ")", "InspectState", "(", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "s", ":=", "struct", "{", "SvcChan", "int", "`json:\"serviceQueue\"`", "\n", "EpChan", "int", "`json:\"endpointQueue\"`", "\n", ...
// InspectState returns state
[ "InspectState", "returns", "state" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netplugin/nameserver/nameserver.go#L572-L582
7,939
contiv/netplugin
netplugin/nameserver/nameserver.go
NsLookup
func (ens *NetpluginNameServer) NsLookup(nsq []byte, vrfPtr *string) ([]byte, error) { tenant := *vrfPtr req := new(dns.Msg) err := req.Unpack(nsq) if err != nil { ens.incTenantStats(tenant, "invalidQuery") return nil, err } // no fancy requests if req.Response { ens.incTenantStats(tenant, "invalidQuery")...
go
func (ens *NetpluginNameServer) NsLookup(nsq []byte, vrfPtr *string) ([]byte, error) { tenant := *vrfPtr req := new(dns.Msg) err := req.Unpack(nsq) if err != nil { ens.incTenantStats(tenant, "invalidQuery") return nil, err } // no fancy requests if req.Response { ens.incTenantStats(tenant, "invalidQuery")...
[ "func", "(", "ens", "*", "NetpluginNameServer", ")", "NsLookup", "(", "nsq", "[", "]", "byte", ",", "vrfPtr", "*", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "tenant", ":=", "*", "vrfPtr", "\n", "req", ":=", "new", "(", "dns", ...
// NsLookup returns name record,called from ofnet agent
[ "NsLookup", "returns", "name", "record", "called", "from", "ofnet", "agent" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netplugin/nameserver/nameserver.go#L585-L615
7,940
contiv/netplugin
netplugin/nameserver/nameserver.go
Init
func (ens *NetpluginNameServer) Init(sd core.StateDriver) error { dnsLog = logrus.WithField("module", "nameserver") ens.bucketSize = 64 ens.stateDriver = sd // don't change buffering ens.epChan = make(chan core.WatchState, 64) ens.epErrChan = make(chan error) ens.svcChan = make(chan core.WatchState, 8) ens.svc...
go
func (ens *NetpluginNameServer) Init(sd core.StateDriver) error { dnsLog = logrus.WithField("module", "nameserver") ens.bucketSize = 64 ens.stateDriver = sd // don't change buffering ens.epChan = make(chan core.WatchState, 64) ens.epErrChan = make(chan error) ens.svcChan = make(chan core.WatchState, 8) ens.svc...
[ "func", "(", "ens", "*", "NetpluginNameServer", ")", "Init", "(", "sd", "core", ".", "StateDriver", ")", "error", "{", "dnsLog", "=", "logrus", ".", "WithField", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "ens", ".", "bucketSize", "=", "64", "\n", ...
// Init to start name server
[ "Init", "to", "start", "name", "server" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netplugin/nameserver/nameserver.go#L693-L718
7,941
contiv/netplugin
netmaster/master/bgp.go
AddBgp
func AddBgp(stateDriver core.StateDriver, bgpCfg *intent.ConfigBgp) error { log.Infof("Adding bgp neighbor {%v}", bgpCfg) aci, _ := IsAciConfigured() if aci { log.Errorf("Invalid configuration. Not supported in ACI fabric mode.") return errors.New("not supported in ACI fabric mode") } bgpState := &mastercfg.C...
go
func AddBgp(stateDriver core.StateDriver, bgpCfg *intent.ConfigBgp) error { log.Infof("Adding bgp neighbor {%v}", bgpCfg) aci, _ := IsAciConfigured() if aci { log.Errorf("Invalid configuration. Not supported in ACI fabric mode.") return errors.New("not supported in ACI fabric mode") } bgpState := &mastercfg.C...
[ "func", "AddBgp", "(", "stateDriver", "core", ".", "StateDriver", ",", "bgpCfg", "*", "intent", ".", "ConfigBgp", ")", "error", "{", "log", ".", "Infof", "(", "\"", "\"", ",", "bgpCfg", ")", "\n", "aci", ",", "_", ":=", "IsAciConfigured", "(", ")", "...
//AddBgp adds to the etcd state
[ "AddBgp", "adds", "to", "the", "etcd", "state" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netmaster/master/bgp.go#L28-L45
7,942
contiv/netplugin
netmaster/master/bgp.go
DeleteBgp
func DeleteBgp(stateDriver core.StateDriver, hostname string) error { log.Infof("Deleting bgp neighbor for {%v}", hostname) bgpState := &mastercfg.CfgBgpState{} bgpState.StateDriver = stateDriver err := bgpState.Read(hostname) if err != nil { log.Errorf("Error reading bgp config for hostname %s", hostname) ret...
go
func DeleteBgp(stateDriver core.StateDriver, hostname string) error { log.Infof("Deleting bgp neighbor for {%v}", hostname) bgpState := &mastercfg.CfgBgpState{} bgpState.StateDriver = stateDriver err := bgpState.Read(hostname) if err != nil { log.Errorf("Error reading bgp config for hostname %s", hostname) ret...
[ "func", "DeleteBgp", "(", "stateDriver", "core", ".", "StateDriver", ",", "hostname", "string", ")", "error", "{", "log", ".", "Infof", "(", "\"", "\"", ",", "hostname", ")", "\n", "bgpState", ":=", "&", "mastercfg", ".", "CfgBgpState", "{", "}", "\n", ...
//DeleteBgp deletes from etcd state
[ "DeleteBgp", "deletes", "from", "etcd", "state" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netmaster/master/bgp.go#L48-L64
7,943
contiv/netplugin
objdb/etcdLock.go
NewLock
func (ep *EtcdClient) NewLock(name string, myID string, ttl uint64) (LockInterface, error) { watchCtx, watchCancel := context.WithCancel(context.Background()) // Create a lock return &etcdLock{ name: name, myID: myID, ttl: time.Duration(ttl) * time.Second, kapi: ep.kapi, eventC...
go
func (ep *EtcdClient) NewLock(name string, myID string, ttl uint64) (LockInterface, error) { watchCtx, watchCancel := context.WithCancel(context.Background()) // Create a lock return &etcdLock{ name: name, myID: myID, ttl: time.Duration(ttl) * time.Second, kapi: ep.kapi, eventC...
[ "func", "(", "ep", "*", "EtcdClient", ")", "NewLock", "(", "name", "string", ",", "myID", "string", ",", "ttl", "uint64", ")", "(", "LockInterface", ",", "error", ")", "{", "watchCtx", ",", "watchCancel", ":=", "context", ".", "WithCancel", "(", "context...
// NewLock Create a new lock
[ "NewLock", "Create", "a", "new", "lock" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/objdb/etcdLock.go#L33-L48
7,944
contiv/netplugin
objdb/etcdLock.go
waitForLock
func (lk *etcdLock) waitForLock() { // If timeout is not specified, set it to high value timeoutIntvl := time.Second * time.Duration(20000) if lk.timeout != 0 { timeoutIntvl = time.Second * time.Duration(lk.timeout) } log.Infof("Waiting to acquire lock (%s/%s)", lk.name, lk.myID) // Create a timer timer := t...
go
func (lk *etcdLock) waitForLock() { // If timeout is not specified, set it to high value timeoutIntvl := time.Second * time.Duration(20000) if lk.timeout != 0 { timeoutIntvl = time.Second * time.Duration(lk.timeout) } log.Infof("Waiting to acquire lock (%s/%s)", lk.name, lk.myID) // Create a timer timer := t...
[ "func", "(", "lk", "*", "etcdLock", ")", "waitForLock", "(", ")", "{", "// If timeout is not specified, set it to high value", "timeoutIntvl", ":=", "time", ".", "Second", "*", "time", ".", "Duration", "(", "20000", ")", "\n", "if", "lk", ".", "timeout", "!=",...
// We couldnt acquire lock, Wait for changes on the lock
[ "We", "couldnt", "acquire", "lock", "Wait", "for", "changes", "on", "the", "lock" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/objdb/etcdLock.go#L236-L287
7,945
contiv/netplugin
objdb/etcdLock.go
watchLock
func (lk *etcdLock) watchLock() { keyName := "/contiv.io/lock/" + lk.name watcher := lk.kapi.Watcher(keyName, nil) if watcher == nil { log.Errorf("Error creating the watcher") return } for { resp, err := watcher.Next(lk.watchCtx) if err != nil && (err.Error() == client.ErrClusterUnavailable.Error() || ...
go
func (lk *etcdLock) watchLock() { keyName := "/contiv.io/lock/" + lk.name watcher := lk.kapi.Watcher(keyName, nil) if watcher == nil { log.Errorf("Error creating the watcher") return } for { resp, err := watcher.Next(lk.watchCtx) if err != nil && (err.Error() == client.ErrClusterUnavailable.Error() || ...
[ "func", "(", "lk", "*", "etcdLock", ")", "watchLock", "(", ")", "{", "keyName", ":=", "\"", "\"", "+", "lk", ".", "name", "\n\n", "watcher", ":=", "lk", ".", "kapi", ".", "Watcher", "(", "keyName", ",", "nil", ")", "\n", "if", "watcher", "==", "n...
// Watch for changes on the lock
[ "Watch", "for", "changes", "on", "the", "lock" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/objdb/etcdLock.go#L346-L377
7,946
contiv/netplugin
utils/driverfactory.go
initHelper
func initHelper(driverRegistry map[string]driverConfigTypes, driverName string) (core.Driver, error) { if _, ok := driverRegistry[driverName]; ok { driverType := driverRegistry[driverName].DriverType driver := reflect.New(driverType).Interface() return driver, nil } return nil, core.Errorf("Failed to find a ...
go
func initHelper(driverRegistry map[string]driverConfigTypes, driverName string) (core.Driver, error) { if _, ok := driverRegistry[driverName]; ok { driverType := driverRegistry[driverName].DriverType driver := reflect.New(driverType).Interface() return driver, nil } return nil, core.Errorf("Failed to find a ...
[ "func", "initHelper", "(", "driverRegistry", "map", "[", "string", "]", "driverConfigTypes", ",", "driverName", "string", ")", "(", "core", ".", "Driver", ",", "error", ")", "{", "if", "_", ",", "ok", ":=", "driverRegistry", "[", "driverName", "]", ";", ...
// initHelper initializes the NetPlugin by mapping driver names to // configuration, then it imports the configuration.
[ "initHelper", "initializes", "the", "NetPlugin", "by", "mapping", "driver", "names", "to", "configuration", "then", "it", "imports", "the", "configuration", "." ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/utils/driverfactory.go#L70-L79
7,947
contiv/netplugin
utils/driverfactory.go
NewStateDriver
func NewStateDriver(name string, instInfo *core.InstanceInfo) (core.StateDriver, error) { if name == "" || instInfo == nil { return nil, core.Errorf("invalid driver name or configuration passed.") } if gStateDriver != nil { return nil, core.Errorf("statedriver instance already exists.") } driver, err := init...
go
func NewStateDriver(name string, instInfo *core.InstanceInfo) (core.StateDriver, error) { if name == "" || instInfo == nil { return nil, core.Errorf("invalid driver name or configuration passed.") } if gStateDriver != nil { return nil, core.Errorf("statedriver instance already exists.") } driver, err := init...
[ "func", "NewStateDriver", "(", "name", "string", ",", "instInfo", "*", "core", ".", "InstanceInfo", ")", "(", "core", ".", "StateDriver", ",", "error", ")", "{", "if", "name", "==", "\"", "\"", "||", "instInfo", "==", "nil", "{", "return", "nil", ",", ...
// NewStateDriver instantiates a 'named' state-driver with specified configuration
[ "NewStateDriver", "instantiates", "a", "named", "state", "-", "driver", "with", "specified", "configuration" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/utils/driverfactory.go#L82-L104
7,948
contiv/netplugin
utils/driverfactory.go
GetStateDriver
func GetStateDriver() (core.StateDriver, error) { if gStateDriver == nil { return nil, core.Errorf("statedriver has not been not created.") } return gStateDriver, nil }
go
func GetStateDriver() (core.StateDriver, error) { if gStateDriver == nil { return nil, core.Errorf("statedriver has not been not created.") } return gStateDriver, nil }
[ "func", "GetStateDriver", "(", ")", "(", "core", ".", "StateDriver", ",", "error", ")", "{", "if", "gStateDriver", "==", "nil", "{", "return", "nil", ",", "core", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "gStateDriver", ",", ...
// GetStateDriver returns the singleton instance of the state-driver
[ "GetStateDriver", "returns", "the", "singleton", "instance", "of", "the", "state", "-", "driver" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/utils/driverfactory.go#L107-L113
7,949
contiv/netplugin
utils/driverfactory.go
NewNetworkDriver
func NewNetworkDriver(name string, instInfo *core.InstanceInfo) (core.NetworkDriver, error) { if name == "" || instInfo == nil { return nil, core.Errorf("invalid driver name or configuration passed.") } driver, err := initHelper(networkDriverRegistry, name) if err != nil { return nil, err } d := driver.(cor...
go
func NewNetworkDriver(name string, instInfo *core.InstanceInfo) (core.NetworkDriver, error) { if name == "" || instInfo == nil { return nil, core.Errorf("invalid driver name or configuration passed.") } driver, err := initHelper(networkDriverRegistry, name) if err != nil { return nil, err } d := driver.(cor...
[ "func", "NewNetworkDriver", "(", "name", "string", ",", "instInfo", "*", "core", ".", "InstanceInfo", ")", "(", "core", ".", "NetworkDriver", ",", "error", ")", "{", "if", "name", "==", "\"", "\"", "||", "instInfo", "==", "nil", "{", "return", "nil", "...
// NewNetworkDriver instantiates a 'named' network-driver with specified configuration
[ "NewNetworkDriver", "instantiates", "a", "named", "network", "-", "driver", "with", "specified", "configuration" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/utils/driverfactory.go#L124-L141
7,950
contiv/netplugin
utils/configs.go
BuildNetworkFlags
func BuildNetworkFlags(binary string) []cli.Flag { binUpper := strings.ToUpper(binary) binLower := strings.ToLower(binary) return []cli.Flag{ cli.StringFlag{ Name: "mode, plugin-mode, cluster-mode", EnvVar: fmt.Sprintf("CONTIV_%s_MODE", binUpper), Usage: fmt.Sprintf("set %s mode, options: [docker, kube...
go
func BuildNetworkFlags(binary string) []cli.Flag { binUpper := strings.ToUpper(binary) binLower := strings.ToLower(binary) return []cli.Flag{ cli.StringFlag{ Name: "mode, plugin-mode, cluster-mode", EnvVar: fmt.Sprintf("CONTIV_%s_MODE", binUpper), Usage: fmt.Sprintf("set %s mode, options: [docker, kube...
[ "func", "BuildNetworkFlags", "(", "binary", "string", ")", "[", "]", "cli", ".", "Flag", "{", "binUpper", ":=", "strings", ".", "ToUpper", "(", "binary", ")", "\n", "binLower", ":=", "strings", ".", "ToLower", "(", "binary", ")", "\n", "return", "[", "...
// BuildNetworkFlags CLI networking flags for given binary
[ "BuildNetworkFlags", "CLI", "networking", "flags", "for", "given", "binary" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/utils/configs.go#L16-L46
7,951
contiv/netplugin
utils/configs.go
BuildLogFlags
func BuildLogFlags(binary string) []cli.Flag { binUpper := strings.ToUpper(binary) binLower := strings.ToLower(binary) return []cli.Flag{ cli.StringFlag{ Name: "log-level", Value: "INFO", EnvVar: fmt.Sprintf("CONTIV_%s_LOG_LEVEL", binUpper), Usage: fmt.Sprintf("set %s log level, options: [DEBUG, IN...
go
func BuildLogFlags(binary string) []cli.Flag { binUpper := strings.ToUpper(binary) binLower := strings.ToLower(binary) return []cli.Flag{ cli.StringFlag{ Name: "log-level", Value: "INFO", EnvVar: fmt.Sprintf("CONTIV_%s_LOG_LEVEL", binUpper), Usage: fmt.Sprintf("set %s log level, options: [DEBUG, IN...
[ "func", "BuildLogFlags", "(", "binary", "string", ")", "[", "]", "cli", ".", "Flag", "{", "binUpper", ":=", "strings", ".", "ToUpper", "(", "binary", ")", "\n", "binLower", ":=", "strings", ".", "ToLower", "(", "binary", ")", "\n", "return", "[", "]", ...
// BuildLogFlags CLI logging flags for given binary
[ "BuildLogFlags", "CLI", "logging", "flags", "for", "given", "binary" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/utils/configs.go#L80-L107
7,952
contiv/netplugin
utils/configs.go
InitLogging
func InitLogging(binary string, ctx *cli.Context) error { logLevel, err := logrus.ParseLevel(ctx.String("log-level")) if err != nil { return err } logrus.SetLevel(logLevel) logrus.Infof("Using %v log level: %v", binary, logLevel) if ctx.Bool("use-syslog") { syslogURL := ctx.String("syslog-url") if err := c...
go
func InitLogging(binary string, ctx *cli.Context) error { logLevel, err := logrus.ParseLevel(ctx.String("log-level")) if err != nil { return err } logrus.SetLevel(logLevel) logrus.Infof("Using %v log level: %v", binary, logLevel) if ctx.Bool("use-syslog") { syslogURL := ctx.String("syslog-url") if err := c...
[ "func", "InitLogging", "(", "binary", "string", ",", "ctx", "*", "cli", ".", "Context", ")", "error", "{", "logLevel", ",", "err", ":=", "logrus", ".", "ParseLevel", "(", "ctx", ".", "String", "(", "\"", "\"", ")", ")", "\n", "if", "err", "!=", "ni...
// InitLogging initiates logging from CLI options
[ "InitLogging", "initiates", "logging", "from", "CLI", "options" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/utils/configs.go#L149-L175
7,953
contiv/netplugin
utils/configs.go
ValidateDBOptions
func ValidateDBOptions(binary string, ctx *cli.Context) (*DBConfigs, error) { var storeDriver string var storeURL string var storeURLs string etcdURLs := ctx.String("etcd") consulURLs := ctx.String("consul") if etcdURLs != "" && consulURLs != "" { return nil, fmt.Errorf("ambiguous %s db endpoints, both etcd an...
go
func ValidateDBOptions(binary string, ctx *cli.Context) (*DBConfigs, error) { var storeDriver string var storeURL string var storeURLs string etcdURLs := ctx.String("etcd") consulURLs := ctx.String("consul") if etcdURLs != "" && consulURLs != "" { return nil, fmt.Errorf("ambiguous %s db endpoints, both etcd an...
[ "func", "ValidateDBOptions", "(", "binary", "string", ",", "ctx", "*", "cli", ".", "Context", ")", "(", "*", "DBConfigs", ",", "error", ")", "{", "var", "storeDriver", "string", "\n", "var", "storeURL", "string", "\n", "var", "storeURLs", "string", "\n", ...
// ValidateDBOptions returns error if db options are not valid
[ "ValidateDBOptions", "returns", "error", "if", "db", "options", "are", "not", "valid" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/utils/configs.go#L178-L217
7,954
contiv/netplugin
utils/configs.go
ValidateNetworkOptions
func ValidateNetworkOptions(binary string, ctx *cli.Context) (*NetworkConfigs, error) { // 1. validate and set plugin mode pluginMode := strings.ToLower(ctx.String("mode")) switch pluginMode { case core.Docker, core.Kubernetes, core.SwarmMode, core.Test: logrus.Infof("Using %s mode: %v", binary, pluginMode) case...
go
func ValidateNetworkOptions(binary string, ctx *cli.Context) (*NetworkConfigs, error) { // 1. validate and set plugin mode pluginMode := strings.ToLower(ctx.String("mode")) switch pluginMode { case core.Docker, core.Kubernetes, core.SwarmMode, core.Test: logrus.Infof("Using %s mode: %v", binary, pluginMode) case...
[ "func", "ValidateNetworkOptions", "(", "binary", "string", ",", "ctx", "*", "cli", ".", "Context", ")", "(", "*", "NetworkConfigs", ",", "error", ")", "{", "// 1. validate and set plugin mode", "pluginMode", ":=", "strings", ".", "ToLower", "(", "ctx", ".", "S...
// ValidateNetworkOptions returns error if network options are not valid
[ "ValidateNetworkOptions", "returns", "error", "if", "network", "options", "are", "not", "valid" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/utils/configs.go#L220-L259
7,955
contiv/netplugin
utils/configs.go
FlattenFlags
func FlattenFlags(flagSlices ...[]cli.Flag) []cli.Flag { var flags []cli.Flag for _, slice := range flagSlices { flags = append(flags, slice...) } return flags }
go
func FlattenFlags(flagSlices ...[]cli.Flag) []cli.Flag { var flags []cli.Flag for _, slice := range flagSlices { flags = append(flags, slice...) } return flags }
[ "func", "FlattenFlags", "(", "flagSlices", "...", "[", "]", "cli", ".", "Flag", ")", "[", "]", "cli", ".", "Flag", "{", "var", "flags", "[", "]", "cli", ".", "Flag", "\n", "for", "_", ",", "slice", ":=", "range", "flagSlices", "{", "flags", "=", ...
// FlattenFlags concatenate slices of flags into one slice
[ "FlattenFlags", "concatenate", "slices", "of", "flags", "into", "one", "slice" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/utils/configs.go#L262-L268
7,956
contiv/netplugin
utils/configs.go
FilterEmpty
func FilterEmpty(stringSlice []string) []string { var result []string for _, str := range stringSlice { if str != "" { result = append(result, str) } } return result }
go
func FilterEmpty(stringSlice []string) []string { var result []string for _, str := range stringSlice { if str != "" { result = append(result, str) } } return result }
[ "func", "FilterEmpty", "(", "stringSlice", "[", "]", "string", ")", "[", "]", "string", "{", "var", "result", "[", "]", "string", "\n", "for", "_", ",", "str", ":=", "range", "stringSlice", "{", "if", "str", "!=", "\"", "\"", "{", "result", "=", "a...
// FilterEmpty filters empty string from string slices
[ "FilterEmpty", "filters", "empty", "string", "from", "string", "slices" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/utils/configs.go#L271-L279
7,957
contiv/netplugin
utils/sysutils.go
FetchSysAttrs
func FetchSysAttrs() error { output, err := ioutil.ReadFile("/etc/os-release") if err != nil { log.Errorf("Error reading the /etc/os-release Error: %s Output: \n%s\n", err, output) return err } strOutput := string(output) if strings.Contains(strOutput, "CentOS") { SysAttrs.OsType = "centos" } else if strin...
go
func FetchSysAttrs() error { output, err := ioutil.ReadFile("/etc/os-release") if err != nil { log.Errorf("Error reading the /etc/os-release Error: %s Output: \n%s\n", err, output) return err } strOutput := string(output) if strings.Contains(strOutput, "CentOS") { SysAttrs.OsType = "centos" } else if strin...
[ "func", "FetchSysAttrs", "(", ")", "error", "{", "output", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Errorf", "(", "\"", "\\n", "\\n", "\"", ",", "err", ",", "output", ")"...
// FetchSysAttrs would read the system attributes and store them in the // exported vars for the plugin to use; some of the attributes may need OS // spefici methods to fetch, thus the first attribute to fetch is the OS type
[ "FetchSysAttrs", "would", "read", "the", "system", "attributes", "and", "store", "them", "in", "the", "exported", "vars", "for", "the", "plugin", "to", "use", ";", "some", "of", "the", "attributes", "may", "need", "OS", "spefici", "methods", "to", "fetch", ...
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/utils/sysutils.go#L46-L64
7,958
contiv/netplugin
drivers/ovsd/nodeProxy.go
NewNodeProxy
func NewNodeProxy() (*NodeSvcProxy, error) { ipTablesPath, err := osexec.LookPath("iptables") if err != nil { return nil, err } // Install contiv chain and jump out, err := osexec.Command(ipTablesPath, "-w", iptablesWaitLock, "-t", "nat", "-N", contivNPChain).CombinedOutput() if err != nil { if !strings.Co...
go
func NewNodeProxy() (*NodeSvcProxy, error) { ipTablesPath, err := osexec.LookPath("iptables") if err != nil { return nil, err } // Install contiv chain and jump out, err := osexec.Command(ipTablesPath, "-w", iptablesWaitLock, "-t", "nat", "-N", contivNPChain).CombinedOutput() if err != nil { if !strings.Co...
[ "func", "NewNodeProxy", "(", ")", "(", "*", "NodeSvcProxy", ",", "error", ")", "{", "ipTablesPath", ",", "err", ":=", "osexec", ".", "LookPath", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\...
// NewNodeProxy creates an instance of the node proxy
[ "NewNodeProxy", "creates", "an", "instance", "of", "the", "node", "proxy" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/drivers/ovsd/nodeProxy.go#L49-L92
7,959
contiv/netplugin
drivers/ovsd/nodeProxy.go
DeleteLocalIP
func (p *NodeSvcProxy) DeleteLocalIP(globalIP string) { // strip cidr globalIP = strings.Split(globalIP, "/")[0] p.Mutex.Lock() defer p.Mutex.Unlock() delete(p.LocalIP, globalIP) }
go
func (p *NodeSvcProxy) DeleteLocalIP(globalIP string) { // strip cidr globalIP = strings.Split(globalIP, "/")[0] p.Mutex.Lock() defer p.Mutex.Unlock() delete(p.LocalIP, globalIP) }
[ "func", "(", "p", "*", "NodeSvcProxy", ")", "DeleteLocalIP", "(", "globalIP", "string", ")", "{", "// strip cidr", "globalIP", "=", "strings", ".", "Split", "(", "globalIP", ",", "\"", "\"", ")", "[", "0", "]", "\n", "p", ".", "Mutex", ".", "Lock", "...
// DeleteLocalIP removes an entry from the localIP map
[ "DeleteLocalIP", "removes", "an", "entry", "from", "the", "localIP", "map" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/drivers/ovsd/nodeProxy.go#L95-L101
7,960
contiv/netplugin
drivers/ovsd/nodeProxy.go
AddLocalIP
func (p *NodeSvcProxy) AddLocalIP(globalIP, localIP string) { // strip cidr globalIP = strings.Split(globalIP, "/")[0] localIP = strings.Split(localIP, "/")[0] p.Mutex.Lock() defer p.Mutex.Unlock() p.LocalIP[globalIP] = localIP }
go
func (p *NodeSvcProxy) AddLocalIP(globalIP, localIP string) { // strip cidr globalIP = strings.Split(globalIP, "/")[0] localIP = strings.Split(localIP, "/")[0] p.Mutex.Lock() defer p.Mutex.Unlock() p.LocalIP[globalIP] = localIP }
[ "func", "(", "p", "*", "NodeSvcProxy", ")", "AddLocalIP", "(", "globalIP", ",", "localIP", "string", ")", "{", "// strip cidr", "globalIP", "=", "strings", ".", "Split", "(", "globalIP", ",", "\"", "\"", ")", "[", "0", "]", "\n", "localIP", "=", "strin...
// AddLocalIP adds an entry to the localIP map
[ "AddLocalIP", "adds", "an", "entry", "to", "the", "localIP", "map" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/drivers/ovsd/nodeProxy.go#L104-L111
7,961
contiv/netplugin
drivers/ovsd/nodeProxy.go
AddSvcSpec
func (p *NodeSvcProxy) AddSvcSpec(svcName string, spec *core.ServiceSpec) error { p.Mutex.Lock() defer p.Mutex.Unlock() log.Infof("Node proxy AddSvcSpec: %s", svcName) // Determine if this is a node service isNodeSvc := false for _, port := range spec.Ports { if port.NodePort != 0 && port.Protocol == "TCP" { ...
go
func (p *NodeSvcProxy) AddSvcSpec(svcName string, spec *core.ServiceSpec) error { p.Mutex.Lock() defer p.Mutex.Unlock() log.Infof("Node proxy AddSvcSpec: %s", svcName) // Determine if this is a node service isNodeSvc := false for _, port := range spec.Ports { if port.NodePort != 0 && port.Protocol == "TCP" { ...
[ "func", "(", "p", "*", "NodeSvcProxy", ")", "AddSvcSpec", "(", "svcName", "string", ",", "spec", "*", "core", ".", "ServiceSpec", ")", "error", "{", "p", ".", "Mutex", ".", "Lock", "(", ")", "\n", "defer", "p", ".", "Mutex", ".", "Unlock", "(", ")"...
// AddSvcSpec adds a service to the proxy
[ "AddSvcSpec", "adds", "a", "service", "to", "the", "proxy" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/drivers/ovsd/nodeProxy.go#L133-L156
7,962
contiv/netplugin
drivers/ovsd/nodeProxy.go
DelSvcSpec
func (p *NodeSvcProxy) DelSvcSpec(svcName string, spec *core.ServiceSpec) error { p.Mutex.Lock() defer p.Mutex.Unlock() p.deleteSvc(svcName) // delete it if it exists return nil }
go
func (p *NodeSvcProxy) DelSvcSpec(svcName string, spec *core.ServiceSpec) error { p.Mutex.Lock() defer p.Mutex.Unlock() p.deleteSvc(svcName) // delete it if it exists return nil }
[ "func", "(", "p", "*", "NodeSvcProxy", ")", "DelSvcSpec", "(", "svcName", "string", ",", "spec", "*", "core", ".", "ServiceSpec", ")", "error", "{", "p", ".", "Mutex", ".", "Lock", "(", ")", "\n", "defer", "p", ".", "Mutex", ".", "Unlock", "(", ")"...
// DelSvcSpec deletes a service from the proxy
[ "DelSvcSpec", "deletes", "a", "service", "from", "the", "proxy" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/drivers/ovsd/nodeProxy.go#L159-L164
7,963
contiv/netplugin
netctl/netctl.go
readLoginCredentials
func readLoginCredentials(ctx *cli.Context) (string, string) { fmt.Print("Username: ") reader := bufio.NewReader(os.Stdin) username, err := reader.ReadString('\n') if err != nil { errExit(ctx, exitIO, err.Error(), false) } username = strings.TrimSpace(username) // ReadString includes the newline if len(usern...
go
func readLoginCredentials(ctx *cli.Context) (string, string) { fmt.Print("Username: ") reader := bufio.NewReader(os.Stdin) username, err := reader.ReadString('\n') if err != nil { errExit(ctx, exitIO, err.Error(), false) } username = strings.TrimSpace(username) // ReadString includes the newline if len(usern...
[ "func", "readLoginCredentials", "(", "ctx", "*", "cli", ".", "Context", ")", "(", "string", ",", "string", ")", "{", "fmt", ".", "Print", "(", "\"", "\"", ")", "\n\n", "reader", ":=", "bufio", ".", "NewReader", "(", "os", ".", "Stdin", ")", "\n", "...
// readLoginCredentials prompts for a username and password and returns them. // password input is not echoed back to the user for security reasons.
[ "readLoginCredentials", "prompts", "for", "a", "username", "and", "password", "and", "returns", "them", ".", "password", "input", "is", "not", "echoed", "back", "to", "the", "user", "for", "security", "reasons", "." ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netctl/netctl.go#L57-L82
7,964
contiv/netplugin
netctl/netctl.go
addBgp
func addBgp(ctx *cli.Context) { if len(ctx.Args()) < 1 { errExit(ctx, exitHelp, "Host name required", true) } hostname := ctx.Args()[0] routerip := ctx.String("router-ip") asid := ctx.String("as") neighboras := ctx.String("neighbor-as") neighbor := ctx.String("neighbor") //Error checks _, _, err := net.Par...
go
func addBgp(ctx *cli.Context) { if len(ctx.Args()) < 1 { errExit(ctx, exitHelp, "Host name required", true) } hostname := ctx.Args()[0] routerip := ctx.String("router-ip") asid := ctx.String("as") neighboras := ctx.String("neighbor-as") neighbor := ctx.String("neighbor") //Error checks _, _, err := net.Par...
[ "func", "addBgp", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "if", "len", "(", "ctx", ".", "Args", "(", ")", ")", "<", "1", "{", "errExit", "(", "ctx", ",", "exitHelp", ",", "\"", "\"", ",", "true", ")", "\n", "}", "\n\n", "hostname", ...
//addBgp is a netctl interface routine to add //bgp config
[ "addBgp", "is", "a", "netctl", "interface", "routine", "to", "add", "bgp", "config" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netctl/netctl.go#L850-L884
7,965
contiv/netplugin
netctl/netctl.go
deleteBgp
func deleteBgp(ctx *cli.Context) { if len(ctx.Args()) != 1 { errExit(ctx, exitHelp, "Host name required", true) } hostname := ctx.Args()[0] fmt.Printf("Deleting Bgp router config: %s\n", hostname) errCheck(ctx, getClient(ctx).BgpDelete(hostname)) }
go
func deleteBgp(ctx *cli.Context) { if len(ctx.Args()) != 1 { errExit(ctx, exitHelp, "Host name required", true) } hostname := ctx.Args()[0] fmt.Printf("Deleting Bgp router config: %s\n", hostname) errCheck(ctx, getClient(ctx).BgpDelete(hostname)) }
[ "func", "deleteBgp", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "if", "len", "(", "ctx", ".", "Args", "(", ")", ")", "!=", "1", "{", "errExit", "(", "ctx", ",", "exitHelp", ",", "\"", "\"", ",", "true", ")", "\n", "}", "\n\n", "hostname"...
//deleteBgp is a netctl interface routine to delete //bgp config
[ "deleteBgp", "is", "a", "netctl", "interface", "routine", "to", "delete", "bgp", "config" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netctl/netctl.go#L888-L897
7,966
contiv/netplugin
netctl/netctl.go
listBgp
func listBgp(ctx *cli.Context) { if len(ctx.Args()) != 0 { errExit(ctx, exitHelp, "More arguments than required", true) } bgpList, err := getClient(ctx).BgpList() errCheck(ctx, err) if ctx.Bool("json") { dumpJSONList(ctx, bgpList) } else if ctx.Bool("quite") { bgpName := "" for _, bgp := range *bgpList ...
go
func listBgp(ctx *cli.Context) { if len(ctx.Args()) != 0 { errExit(ctx, exitHelp, "More arguments than required", true) } bgpList, err := getClient(ctx).BgpList() errCheck(ctx, err) if ctx.Bool("json") { dumpJSONList(ctx, bgpList) } else if ctx.Bool("quite") { bgpName := "" for _, bgp := range *bgpList ...
[ "func", "listBgp", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "if", "len", "(", "ctx", ".", "Args", "(", ")", ")", "!=", "0", "{", "errExit", "(", "ctx", ",", "exitHelp", ",", "\"", "\"", ",", "true", ")", "\n", "}", "\n\n", "bgpList", ...
//listBgpNeighbors is netctl interface routine to list //Bgp neighbor configs for a given host
[ "listBgpNeighbors", "is", "netctl", "interface", "routine", "to", "list", "Bgp", "neighbor", "configs", "for", "a", "given", "host" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netctl/netctl.go#L901-L933
7,967
contiv/netplugin
netctl/netctl.go
createServiceLB
func createServiceLB(ctx *cli.Context) { if len(ctx.Args()) != 1 { errExit(ctx, exitHelp, "Service name required", true) } serviceName := ctx.Args()[0] serviceSubnet := ctx.String("network") tenantName := ctx.String("tenant") if len(tenantName) == 0 { tenantName = "default" } selectors := ctx.StringSlice("...
go
func createServiceLB(ctx *cli.Context) { if len(ctx.Args()) != 1 { errExit(ctx, exitHelp, "Service name required", true) } serviceName := ctx.Args()[0] serviceSubnet := ctx.String("network") tenantName := ctx.String("tenant") if len(tenantName) == 0 { tenantName = "default" } selectors := ctx.StringSlice("...
[ "func", "createServiceLB", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "if", "len", "(", "ctx", ".", "Args", "(", ")", ")", "!=", "1", "{", "errExit", "(", "ctx", ",", "exitHelp", ",", "\"", "\"", ",", "true", ")", "\n", "}", "\n\n", "ser...
//createServiceLB is a netctl interface routine to delete //service object
[ "createServiceLB", "is", "a", "netctl", "interface", "routine", "to", "delete", "service", "object" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netctl/netctl.go#L1254-L1279
7,968
contiv/netplugin
netctl/netctl.go
deleteServiceLB
func deleteServiceLB(ctx *cli.Context) { if len(ctx.Args()) != 1 { errExit(ctx, exitHelp, "Service name required", true) } serviceName := ctx.Args()[0] tenantName := ctx.String("tenant") if len(tenantName) == 0 { tenantName = "default" } fmt.Printf("Deleting Service %s,%s\n", serviceName, tenantName) err...
go
func deleteServiceLB(ctx *cli.Context) { if len(ctx.Args()) != 1 { errExit(ctx, exitHelp, "Service name required", true) } serviceName := ctx.Args()[0] tenantName := ctx.String("tenant") if len(tenantName) == 0 { tenantName = "default" } fmt.Printf("Deleting Service %s,%s\n", serviceName, tenantName) err...
[ "func", "deleteServiceLB", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "if", "len", "(", "ctx", ".", "Args", "(", ")", ")", "!=", "1", "{", "errExit", "(", "ctx", ",", "exitHelp", ",", "\"", "\"", ",", "true", ")", "\n", "}", "\n\n", "ser...
//deleteServiceLB is a netctl interface routine to delete //service object
[ "deleteServiceLB", "is", "a", "netctl", "interface", "routine", "to", "delete", "service", "object" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netctl/netctl.go#L1283-L1296
7,969
contiv/netplugin
netctl/netctl.go
listServiceLB
func listServiceLB(ctx *cli.Context) { tenantName := ctx.String("tenant") if len(tenantName) == 0 { tenantName = "default" } _, err := getClient(ctx).TenantGet(tenantName) errCheck(ctx, err) svcList, err := getClient(ctx).ServiceLBList() errCheck(ctx, err) filtered := []*contivClient.ServiceLB{} if ctx.B...
go
func listServiceLB(ctx *cli.Context) { tenantName := ctx.String("tenant") if len(tenantName) == 0 { tenantName = "default" } _, err := getClient(ctx).TenantGet(tenantName) errCheck(ctx, err) svcList, err := getClient(ctx).ServiceLBList() errCheck(ctx, err) filtered := []*contivClient.ServiceLB{} if ctx.B...
[ "func", "listServiceLB", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "tenantName", ":=", "ctx", ".", "String", "(", "\"", "\"", ")", "\n", "if", "len", "(", "tenantName", ")", "==", "0", "{", "tenantName", "=", "\"", "\"", "\n", "}", "\n", ...
//listServiceLB is a netctl interface routine to list //service object
[ "listServiceLB", "is", "a", "netctl", "interface", "routine", "to", "list", "service", "object" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netctl/netctl.go#L1300-L1348
7,970
contiv/netplugin
objdb/consulService.go
GetService
func (cp *ConsulClient) GetService(srvName string) ([]ServiceInfo, error) { keyName := "contiv.io/service/" + srvName + "/" srvList, _, err := cp.getServiceInstances(keyName, 0) return srvList, err }
go
func (cp *ConsulClient) GetService(srvName string) ([]ServiceInfo, error) { keyName := "contiv.io/service/" + srvName + "/" srvList, _, err := cp.getServiceInstances(keyName, 0) return srvList, err }
[ "func", "(", "cp", "*", "ConsulClient", ")", "GetService", "(", "srvName", "string", ")", "(", "[", "]", "ServiceInfo", ",", "error", ")", "{", "keyName", ":=", "\"", "\"", "+", "srvName", "+", "\"", "\"", "\n", "srvList", ",", "_", ",", "err", ":=...
// GetService gets all instances of a service
[ "GetService", "gets", "all", "instances", "of", "a", "service" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/objdb/consulService.go#L137-L142
7,971
contiv/netplugin
objdb/consulService.go
WatchService
func (cp *ConsulClient) WatchService(srvName string, eventCh chan WatchServiceEvent, stopCh chan bool) error { keyName := "contiv.io/service/" + srvName + "/" // Run in background go func() { var currSrvMap = make(map[string]ServiceInfo) // Get current list of services srvList, lastIdx, err := cp.getServiceI...
go
func (cp *ConsulClient) WatchService(srvName string, eventCh chan WatchServiceEvent, stopCh chan bool) error { keyName := "contiv.io/service/" + srvName + "/" // Run in background go func() { var currSrvMap = make(map[string]ServiceInfo) // Get current list of services srvList, lastIdx, err := cp.getServiceI...
[ "func", "(", "cp", "*", "ConsulClient", ")", "WatchService", "(", "srvName", "string", ",", "eventCh", "chan", "WatchServiceEvent", ",", "stopCh", "chan", "bool", ")", "error", "{", "keyName", ":=", "\"", "\"", "+", "srvName", "+", "\"", "\"", "\n\n", "/...
// WatchService watches for service instance changes
[ "WatchService", "watches", "for", "service", "instance", "changes" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/objdb/consulService.go#L145-L231
7,972
contiv/netplugin
objdb/consulService.go
DeregisterService
func (cp *ConsulClient) DeregisterService(serviceInfo ServiceInfo) error { keyName := "contiv.io/service/" + serviceInfo.ServiceName + "/" + serviceInfo.HostAddr + ":" + strconv.Itoa(serviceInfo.Port) // Find it in the database srvState := cp.serviceDb[keyName] if srvState == nil { log.Errorf("Could not find t...
go
func (cp *ConsulClient) DeregisterService(serviceInfo ServiceInfo) error { keyName := "contiv.io/service/" + serviceInfo.ServiceName + "/" + serviceInfo.HostAddr + ":" + strconv.Itoa(serviceInfo.Port) // Find it in the database srvState := cp.serviceDb[keyName] if srvState == nil { log.Errorf("Could not find t...
[ "func", "(", "cp", "*", "ConsulClient", ")", "DeregisterService", "(", "serviceInfo", "ServiceInfo", ")", "error", "{", "keyName", ":=", "\"", "\"", "+", "serviceInfo", ".", "ServiceName", "+", "\"", "\"", "+", "serviceInfo", ".", "HostAddr", "+", "\"", "\...
// DeregisterService deregisters a service instance
[ "DeregisterService", "deregisters", "a", "service", "instance" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/objdb/consulService.go#L234-L259
7,973
contiv/netplugin
objdb/consulService.go
getServiceInstances
func (cp *ConsulClient) getServiceInstances(key string, waitIdx uint64) ([]ServiceInfo, uint64, error) { var srvcList []ServiceInfo // Get the object from consul client kvs, meta, err := cp.client.KV().List(key, &api.QueryOptions{WaitIndex: waitIdx}) if err != nil { log.Errorf("Error getting key %s. Err: %v", ke...
go
func (cp *ConsulClient) getServiceInstances(key string, waitIdx uint64) ([]ServiceInfo, uint64, error) { var srvcList []ServiceInfo // Get the object from consul client kvs, meta, err := cp.client.KV().List(key, &api.QueryOptions{WaitIndex: waitIdx}) if err != nil { log.Errorf("Error getting key %s. Err: %v", ke...
[ "func", "(", "cp", "*", "ConsulClient", ")", "getServiceInstances", "(", "key", "string", ",", "waitIdx", "uint64", ")", "(", "[", "]", "ServiceInfo", ",", "uint64", ",", "error", ")", "{", "var", "srvcList", "[", "]", "ServiceInfo", "\n\n", "// Get the ob...
// getServiceInstances gets the current list of service instances
[ "getServiceInstances", "gets", "the", "current", "list", "of", "service", "instances" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/objdb/consulService.go#L303-L333
7,974
contiv/netplugin
netmaster/master/endpointGroup.go
DeleteEndpointGroup
func DeleteEndpointGroup(tenantName, groupName string) error { // Get the state driver stateDriver, err := utils.GetStateDriver() if err != nil { return err } epgKey := mastercfg.GetEndpointGroupKey(groupName, tenantName) epgCfg := &mastercfg.EndpointGroupState{} epgCfg.StateDriver = stateDriver err = epgCfg...
go
func DeleteEndpointGroup(tenantName, groupName string) error { // Get the state driver stateDriver, err := utils.GetStateDriver() if err != nil { return err } epgKey := mastercfg.GetEndpointGroupKey(groupName, tenantName) epgCfg := &mastercfg.EndpointGroupState{} epgCfg.StateDriver = stateDriver err = epgCfg...
[ "func", "DeleteEndpointGroup", "(", "tenantName", ",", "groupName", "string", ")", "error", "{", "// Get the state driver", "stateDriver", ",", "err", ":=", "utils", ".", "GetStateDriver", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", ...
// DeleteEndpointGroup handles endpoint group deletes
[ "DeleteEndpointGroup", "handles", "endpoint", "group", "deletes" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netmaster/master/endpointGroup.go#L180-L256
7,975
contiv/netplugin
netmaster/master/endpointGroup.go
UpdateEndpointGroup
func UpdateEndpointGroup(bandwidth, groupName, tenantName string, Dscp, burst int) error { // Get the state driver - get the etcd driver state stateDriver, err := utils.GetStateDriver() if err != nil { return err } key := mastercfg.GetEndpointGroupKey(groupName, tenantName) if key == "" { return errors.New(...
go
func UpdateEndpointGroup(bandwidth, groupName, tenantName string, Dscp, burst int) error { // Get the state driver - get the etcd driver state stateDriver, err := utils.GetStateDriver() if err != nil { return err } key := mastercfg.GetEndpointGroupKey(groupName, tenantName) if key == "" { return errors.New(...
[ "func", "UpdateEndpointGroup", "(", "bandwidth", ",", "groupName", ",", "tenantName", "string", ",", "Dscp", ",", "burst", "int", ")", "error", "{", "// Get the state driver - get the etcd driver state", "stateDriver", ",", "err", ":=", "utils", ".", "GetStateDriver",...
//UpdateEndpointGroup updates the endpointgroups
[ "UpdateEndpointGroup", "updates", "the", "endpointgroups" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netmaster/master/endpointGroup.go#L259-L289
7,976
contiv/netplugin
netmaster/master/provider.go
SvcProviderUpdate
func SvcProviderUpdate(serviceID string, isDelete bool) error { providerList := []string{} stateDriver, err := utils.GetStateDriver() if err != nil { return err } svcProvider := &mastercfg.SvcProvider{} svcProvider.StateDriver = stateDriver if _, present := mastercfg.ServiceLBDb[serviceID]; !present { svc...
go
func SvcProviderUpdate(serviceID string, isDelete bool) error { providerList := []string{} stateDriver, err := utils.GetStateDriver() if err != nil { return err } svcProvider := &mastercfg.SvcProvider{} svcProvider.StateDriver = stateDriver if _, present := mastercfg.ServiceLBDb[serviceID]; !present { svc...
[ "func", "SvcProviderUpdate", "(", "serviceID", "string", ",", "isDelete", "bool", ")", "error", "{", "providerList", ":=", "[", "]", "string", "{", "}", "\n\n", "stateDriver", ",", "err", ":=", "utils", ".", "GetStateDriver", "(", ")", "\n", "if", "err", ...
//SvcProviderUpdate propagates service provider updates to netplugins
[ "SvcProviderUpdate", "propagates", "service", "provider", "updates", "to", "netplugins" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netmaster/master/provider.go#L25-L55
7,977
contiv/netplugin
core/error.go
ErrIfKeyExists
func ErrIfKeyExists(err error) error { if err == nil || strings.Contains(err.Error(), "key not found") { return nil } return err }
go
func ErrIfKeyExists(err error) error { if err == nil || strings.Contains(err.Error(), "key not found") { return nil } return err }
[ "func", "ErrIfKeyExists", "(", "err", "error", ")", "error", "{", "if", "err", "==", "nil", "||", "strings", ".", "Contains", "(", "err", ".", "Error", "(", ")", ",", "\"", "\"", ")", "{", "return", "nil", "\n", "}", "\n\n", "return", "err", "\n", ...
// ErrIfKeyExists checks if the error message contains "key not found".
[ "ErrIfKeyExists", "checks", "if", "the", "error", "message", "contains", "key", "not", "found", "." ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/core/error.go#L81-L87
7,978
contiv/netplugin
netmaster/resources/vlanresource.go
ReadAll
func (r *AutoVLANCfgResource) ReadAll() ([]core.State, error) { return r.StateDriver.ReadAllState(vLANResourceConfigPathPrefix, r, json.Unmarshal) }
go
func (r *AutoVLANCfgResource) ReadAll() ([]core.State, error) { return r.StateDriver.ReadAllState(vLANResourceConfigPathPrefix, r, json.Unmarshal) }
[ "func", "(", "r", "*", "AutoVLANCfgResource", ")", "ReadAll", "(", ")", "(", "[", "]", "core", ".", "State", ",", "error", ")", "{", "return", "r", ".", "StateDriver", ".", "ReadAllState", "(", "vLANResourceConfigPathPrefix", ",", "r", ",", "json", ".", ...
// ReadAll the state for this resource.
[ "ReadAll", "the", "state", "for", "this", "resource", "." ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netmaster/resources/vlanresource.go#L69-L72
7,979
contiv/netplugin
netmaster/resources/vlanresource.go
Allocate
func (r *AutoVLANCfgResource) Allocate(reqVal interface{}) (interface{}, error) { oper := &AutoVLANOperResource{} oper.StateDriver = r.StateDriver err := oper.Read(r.ID) if err != nil { return nil, err } var vlan uint if (reqVal != nil) && (reqVal.(uint) != 0) { vlan = reqVal.(uint) if !oper.FreeVLANs.Tes...
go
func (r *AutoVLANCfgResource) Allocate(reqVal interface{}) (interface{}, error) { oper := &AutoVLANOperResource{} oper.StateDriver = r.StateDriver err := oper.Read(r.ID) if err != nil { return nil, err } var vlan uint if (reqVal != nil) && (reqVal.(uint) != 0) { vlan = reqVal.(uint) if !oper.FreeVLANs.Tes...
[ "func", "(", "r", "*", "AutoVLANCfgResource", ")", "Allocate", "(", "reqVal", "interface", "{", "}", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "oper", ":=", "&", "AutoVLANOperResource", "{", "}", "\n", "oper", ".", "StateDriver", "=", "r...
// Allocate a resource.
[ "Allocate", "a", "resource", "." ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netmaster/resources/vlanresource.go#L213-L241
7,980
contiv/netplugin
netmaster/resources/vlanresource.go
Deallocate
func (r *AutoVLANCfgResource) Deallocate(value interface{}) error { oper := &AutoVLANOperResource{} oper.StateDriver = r.StateDriver err := oper.Read(r.ID) if err != nil { return err } vlan, ok := value.(uint) if !ok { return core.Errorf("Invalid type for vlan value") } if oper.FreeVLANs.Test(vlan) { re...
go
func (r *AutoVLANCfgResource) Deallocate(value interface{}) error { oper := &AutoVLANOperResource{} oper.StateDriver = r.StateDriver err := oper.Read(r.ID) if err != nil { return err } vlan, ok := value.(uint) if !ok { return core.Errorf("Invalid type for vlan value") } if oper.FreeVLANs.Test(vlan) { re...
[ "func", "(", "r", "*", "AutoVLANCfgResource", ")", "Deallocate", "(", "value", "interface", "{", "}", ")", "error", "{", "oper", ":=", "&", "AutoVLANOperResource", "{", "}", "\n", "oper", ".", "StateDriver", "=", "r", ".", "StateDriver", "\n", "err", ":=...
// Deallocate the resource.
[ "Deallocate", "the", "resource", "." ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netmaster/resources/vlanresource.go#L244-L262
7,981
contiv/netplugin
netmaster/resources/vlanresource.go
ReadAll
func (r *AutoVLANOperResource) ReadAll() ([]core.State, error) { return r.StateDriver.ReadAllState(vLANResourceOperPathPrefix, r, json.Unmarshal) }
go
func (r *AutoVLANOperResource) ReadAll() ([]core.State, error) { return r.StateDriver.ReadAllState(vLANResourceOperPathPrefix, r, json.Unmarshal) }
[ "func", "(", "r", "*", "AutoVLANOperResource", ")", "ReadAll", "(", ")", "(", "[", "]", "core", ".", "State", ",", "error", ")", "{", "return", "r", ".", "StateDriver", ".", "ReadAllState", "(", "vLANResourceOperPathPrefix", ",", "r", ",", "json", ".", ...
// ReadAll state for this path.
[ "ReadAll", "state", "for", "this", "path", "." ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/netmaster/resources/vlanresource.go#L283-L286
7,982
contiv/netplugin
drivers/ovsd/ovsdriver.go
DeleteHostAccPort
func (d *OvsDriver) DeleteHostAccPort(id string) error { sw, found := d.switchDb["host"] if found { operEp := &drivers.OperEndpointState{} operEp.StateDriver = d.oper.StateDriver err := operEp.Read(id) if err != nil { return err } d.HostProxy.DeleteLocalIP(operEp.IPAddress) portName := operEp.PortNam...
go
func (d *OvsDriver) DeleteHostAccPort(id string) error { sw, found := d.switchDb["host"] if found { operEp := &drivers.OperEndpointState{} operEp.StateDriver = d.oper.StateDriver err := operEp.Read(id) if err != nil { return err } d.HostProxy.DeleteLocalIP(operEp.IPAddress) portName := operEp.PortNam...
[ "func", "(", "d", "*", "OvsDriver", ")", "DeleteHostAccPort", "(", "id", "string", ")", "error", "{", "sw", ",", "found", ":=", "d", ".", "switchDb", "[", "\"", "\"", "]", "\n", "if", "found", "{", "operEp", ":=", "&", "drivers", ".", "OperEndpointSt...
//DeleteHostAccPort deletes the access port
[ "DeleteHostAccPort", "deletes", "the", "access", "port" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/drivers/ovsd/ovsdriver.go#L221-L237
7,983
contiv/netplugin
drivers/ovsd/ovsdriver.go
CreateHostAccPort
func (d *OvsDriver) CreateHostAccPort(portName, globalIP string, net int) (string, error) { sw, found := d.switchDb["host"] if found { num := strings.Replace(portName, "hport", "", 1) intfNum, err := strconv.Atoi(num) if err != nil { return "", err } hostIP, err := sw.AddHostPort(portName, intfNum, net,...
go
func (d *OvsDriver) CreateHostAccPort(portName, globalIP string, net int) (string, error) { sw, found := d.switchDb["host"] if found { num := strings.Replace(portName, "hport", "", 1) intfNum, err := strconv.Atoi(num) if err != nil { return "", err } hostIP, err := sw.AddHostPort(portName, intfNum, net,...
[ "func", "(", "d", "*", "OvsDriver", ")", "CreateHostAccPort", "(", "portName", ",", "globalIP", "string", ",", "net", "int", ")", "(", "string", ",", "error", ")", "{", "sw", ",", "found", ":=", "d", ".", "switchDb", "[", "\"", "\"", "]", "\n", "if...
// CreateHostAccPort creates an access port
[ "CreateHostAccPort", "creates", "an", "access", "port" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/drivers/ovsd/ovsdriver.go#L240-L257
7,984
contiv/netplugin
drivers/ovsd/ovsdriver.go
Deinit
func (d *OvsDriver) Deinit() { log.Infof("Cleaning up ovsdriver") // cleanup both vlan and vxlan OVS instances if d.switchDb["vlan"] != nil { d.switchDb["vlan"].RemoveUplinks() d.switchDb["vlan"].Delete() } if d.switchDb["vxlan"] != nil { d.switchDb["vxlan"].DelHostPort(hostPortName, true) d.switchDb["vxl...
go
func (d *OvsDriver) Deinit() { log.Infof("Cleaning up ovsdriver") // cleanup both vlan and vxlan OVS instances if d.switchDb["vlan"] != nil { d.switchDb["vlan"].RemoveUplinks() d.switchDb["vlan"].Delete() } if d.switchDb["vxlan"] != nil { d.switchDb["vxlan"].DelHostPort(hostPortName, true) d.switchDb["vxl...
[ "func", "(", "d", "*", "OvsDriver", ")", "Deinit", "(", ")", "{", "log", ".", "Infof", "(", "\"", "\"", ")", "\n\n", "// cleanup both vlan and vxlan OVS instances", "if", "d", ".", "switchDb", "[", "\"", "\"", "]", "!=", "nil", "{", "d", ".", "switchDb...
// Deinit performs cleanup prior to destruction of the OvsDriver
[ "Deinit", "performs", "cleanup", "prior", "to", "destruction", "of", "the", "OvsDriver" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/drivers/ovsd/ovsdriver.go#L260-L272
7,985
contiv/netplugin
drivers/ovsd/ovsdriver.go
CreateNetwork
func (d *OvsDriver) CreateNetwork(id string) error { cfgNw := mastercfg.CfgNetworkState{} cfgNw.StateDriver = d.oper.StateDriver err := cfgNw.Read(id) if err != nil { log.Errorf("Failed to read net %s \n", cfgNw.ID) return err } log.Infof("create net %+v \n", cfgNw) // Find the switch based on network type ...
go
func (d *OvsDriver) CreateNetwork(id string) error { cfgNw := mastercfg.CfgNetworkState{} cfgNw.StateDriver = d.oper.StateDriver err := cfgNw.Read(id) if err != nil { log.Errorf("Failed to read net %s \n", cfgNw.ID) return err } log.Infof("create net %+v \n", cfgNw) // Find the switch based on network type ...
[ "func", "(", "d", "*", "OvsDriver", ")", "CreateNetwork", "(", "id", "string", ")", "error", "{", "cfgNw", ":=", "mastercfg", ".", "CfgNetworkState", "{", "}", "\n", "cfgNw", ".", "StateDriver", "=", "d", ".", "oper", ".", "StateDriver", "\n", "err", "...
// CreateNetwork creates a network by named identifier
[ "CreateNetwork", "creates", "a", "network", "by", "named", "identifier" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/drivers/ovsd/ovsdriver.go#L275-L294
7,986
contiv/netplugin
drivers/ovsd/ovsdriver.go
DeleteNetwork
func (d *OvsDriver) DeleteNetwork(id, subnet, nwType, encap string, pktTag, extPktTag int, gateway string, tenant string) error { log.Infof("delete net %s, nwType %s, encap %s, tags: %d/%d", id, nwType, encap, pktTag, extPktTag) // Find the switch based on network type var sw *OvsSwitch if encap == "vxlan" { sw ...
go
func (d *OvsDriver) DeleteNetwork(id, subnet, nwType, encap string, pktTag, extPktTag int, gateway string, tenant string) error { log.Infof("delete net %s, nwType %s, encap %s, tags: %d/%d", id, nwType, encap, pktTag, extPktTag) // Find the switch based on network type var sw *OvsSwitch if encap == "vxlan" { sw ...
[ "func", "(", "d", "*", "OvsDriver", ")", "DeleteNetwork", "(", "id", ",", "subnet", ",", "nwType", ",", "encap", "string", ",", "pktTag", ",", "extPktTag", "int", ",", "gateway", "string", ",", "tenant", "string", ")", "error", "{", "log", ".", "Infof"...
// DeleteNetwork deletes a network by named identifier
[ "DeleteNetwork", "deletes", "a", "network", "by", "named", "identifier" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/drivers/ovsd/ovsdriver.go#L297-L326
7,987
contiv/netplugin
drivers/ovsd/ovsdriver.go
UpdateEndpointGroup
func (d *OvsDriver) UpdateEndpointGroup(id string) error { log.Infof("Received endpoint group update for %s", id) var ( err error epgBandwidth int64 sw *OvsSwitch ) //gets the EndpointGroupState object cfgEpGroup := &mastercfg.EndpointGroupState{} cfgEpGroup.StateDriver = d.oper.StateDriv...
go
func (d *OvsDriver) UpdateEndpointGroup(id string) error { log.Infof("Received endpoint group update for %s", id) var ( err error epgBandwidth int64 sw *OvsSwitch ) //gets the EndpointGroupState object cfgEpGroup := &mastercfg.EndpointGroupState{} cfgEpGroup.StateDriver = d.oper.StateDriv...
[ "func", "(", "d", "*", "OvsDriver", ")", "UpdateEndpointGroup", "(", "id", "string", ")", "error", "{", "log", ".", "Infof", "(", "\"", "\"", ",", "id", ")", "\n", "var", "(", "err", "error", "\n", "epgBandwidth", "int64", "\n", "sw", "*", "OvsSwitch...
//UpdateEndpointGroup updates the epg
[ "UpdateEndpointGroup", "updates", "the", "epg" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/drivers/ovsd/ovsdriver.go#L476-L518
7,988
contiv/netplugin
drivers/ovsd/ovsdriver.go
DeleteEndpoint
func (d *OvsDriver) DeleteEndpoint(id string) error { epOper := drivers.OperEndpointState{} epOper.StateDriver = d.oper.StateDriver err := epOper.Read(id) if err != nil { return err } defer func() { epOper.Clear() }() // Get the network state cfgNw := mastercfg.CfgNetworkState{} cfgNw.StateDriver = d.ope...
go
func (d *OvsDriver) DeleteEndpoint(id string) error { epOper := drivers.OperEndpointState{} epOper.StateDriver = d.oper.StateDriver err := epOper.Read(id) if err != nil { return err } defer func() { epOper.Clear() }() // Get the network state cfgNw := mastercfg.CfgNetworkState{} cfgNw.StateDriver = d.ope...
[ "func", "(", "d", "*", "OvsDriver", ")", "DeleteEndpoint", "(", "id", "string", ")", "error", "{", "epOper", ":=", "drivers", ".", "OperEndpointState", "{", "}", "\n", "epOper", ".", "StateDriver", "=", "d", ".", "oper", ".", "StateDriver", "\n", "err", ...
// DeleteEndpoint deletes an endpoint by named identifier.
[ "DeleteEndpoint", "deletes", "an", "endpoint", "by", "named", "identifier", "." ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/drivers/ovsd/ovsdriver.go#L521-L563
7,989
contiv/netplugin
drivers/ovsd/ovsdriver.go
AddPeerHost
func (d *OvsDriver) AddPeerHost(node core.ServiceInfo) error { // Nothing to do if this is our own IP if node.HostAddr == d.localIP { return nil } log.Infof("CreatePeerHost for %+v", node) // Add the VTEP for the peer in vxlan switch. err := d.switchDb["vxlan"].CreateVtep(node.HostAddr) if err != nil { log...
go
func (d *OvsDriver) AddPeerHost(node core.ServiceInfo) error { // Nothing to do if this is our own IP if node.HostAddr == d.localIP { return nil } log.Infof("CreatePeerHost for %+v", node) // Add the VTEP for the peer in vxlan switch. err := d.switchDb["vxlan"].CreateVtep(node.HostAddr) if err != nil { log...
[ "func", "(", "d", "*", "OvsDriver", ")", "AddPeerHost", "(", "node", "core", ".", "ServiceInfo", ")", "error", "{", "// Nothing to do if this is our own IP", "if", "node", ".", "HostAddr", "==", "d", ".", "localIP", "{", "return", "nil", "\n", "}", "\n\n", ...
// AddPeerHost adds VTEPs if necessary
[ "AddPeerHost", "adds", "VTEPs", "if", "necessary" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/drivers/ovsd/ovsdriver.go#L579-L595
7,990
contiv/netplugin
drivers/ovsd/ovsdriver.go
DeletePeerHost
func (d *OvsDriver) DeletePeerHost(node core.ServiceInfo) error { // Nothing to do if this is our own IP if node.HostAddr == d.localIP { return nil } log.Infof("DeletePeerHost for %+v", node) // Remove the VTEP for the peer in vxlan switch. err := d.switchDb["vxlan"].DeleteVtep(node.HostAddr) if err != nil {...
go
func (d *OvsDriver) DeletePeerHost(node core.ServiceInfo) error { // Nothing to do if this is our own IP if node.HostAddr == d.localIP { return nil } log.Infof("DeletePeerHost for %+v", node) // Remove the VTEP for the peer in vxlan switch. err := d.switchDb["vxlan"].DeleteVtep(node.HostAddr) if err != nil {...
[ "func", "(", "d", "*", "OvsDriver", ")", "DeletePeerHost", "(", "node", "core", ".", "ServiceInfo", ")", "error", "{", "// Nothing to do if this is our own IP", "if", "node", ".", "HostAddr", "==", "d", ".", "localIP", "{", "return", "nil", "\n", "}", "\n\n"...
// DeletePeerHost deletes associated VTEP
[ "DeletePeerHost", "deletes", "associated", "VTEP" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/drivers/ovsd/ovsdriver.go#L598-L614
7,991
contiv/netplugin
drivers/ovsd/ovsdriver.go
AddBgp
func (d *OvsDriver) AddBgp(id string) error { var sw *OvsSwitch cfg := mastercfg.CfgBgpState{} cfg.StateDriver = d.oper.StateDriver err := cfg.Read(id) if err != nil { log.Errorf("Failed to read router state %s \n", cfg.Hostname) return err } log.Infof("Create Bgp :%+v", cfg) // Find the switch based on n...
go
func (d *OvsDriver) AddBgp(id string) error { var sw *OvsSwitch cfg := mastercfg.CfgBgpState{} cfg.StateDriver = d.oper.StateDriver err := cfg.Read(id) if err != nil { log.Errorf("Failed to read router state %s \n", cfg.Hostname) return err } log.Infof("Create Bgp :%+v", cfg) // Find the switch based on n...
[ "func", "(", "d", "*", "OvsDriver", ")", "AddBgp", "(", "id", "string", ")", "error", "{", "var", "sw", "*", "OvsSwitch", "\n\n", "cfg", ":=", "mastercfg", ".", "CfgBgpState", "{", "}", "\n", "cfg", ".", "StateDriver", "=", "d", ".", "oper", ".", "...
// AddBgp adds bgp config by named identifier
[ "AddBgp", "adds", "bgp", "config", "by", "named", "identifier" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/drivers/ovsd/ovsdriver.go#L641-L657
7,992
contiv/netplugin
drivers/ovsd/ovsdriver.go
DeleteBgp
func (d *OvsDriver) DeleteBgp(id string) error { log.Infof("Delete Bgp Neighbor %s \n", id) //FixME: We are not maintaining oper state for Bgp //Need to Revisit again // Find the switch based on network type var sw *OvsSwitch sw = d.switchDb["vlan"] return sw.DeleteBgp() }
go
func (d *OvsDriver) DeleteBgp(id string) error { log.Infof("Delete Bgp Neighbor %s \n", id) //FixME: We are not maintaining oper state for Bgp //Need to Revisit again // Find the switch based on network type var sw *OvsSwitch sw = d.switchDb["vlan"] return sw.DeleteBgp() }
[ "func", "(", "d", "*", "OvsDriver", ")", "DeleteBgp", "(", "id", "string", ")", "error", "{", "log", ".", "Infof", "(", "\"", "\\n", "\"", ",", "id", ")", "\n", "//FixME: We are not maintaining oper state for Bgp", "//Need to Revisit again", "// Find the switch ba...
// DeleteBgp deletes bgp config by named identifier
[ "DeleteBgp", "deletes", "bgp", "config", "by", "named", "identifier" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/drivers/ovsd/ovsdriver.go#L660-L669
7,993
contiv/netplugin
drivers/ovsd/ovsdriver.go
convSvcSpec
func convSvcSpec(spec *core.ServiceSpec) *ofnet.ServiceSpec { pSpec := make([]ofnet.PortSpec, len(spec.Ports)) for ix, p := range spec.Ports { pSpec[ix].Protocol = p.Protocol pSpec[ix].SvcPort = p.SvcPort pSpec[ix].ProvPort = p.ProvPort } ofnetSS := ofnet.ServiceSpec{ IpAddress: spec.IPAddress, Ports: ...
go
func convSvcSpec(spec *core.ServiceSpec) *ofnet.ServiceSpec { pSpec := make([]ofnet.PortSpec, len(spec.Ports)) for ix, p := range spec.Ports { pSpec[ix].Protocol = p.Protocol pSpec[ix].SvcPort = p.SvcPort pSpec[ix].ProvPort = p.ProvPort } ofnetSS := ofnet.ServiceSpec{ IpAddress: spec.IPAddress, Ports: ...
[ "func", "convSvcSpec", "(", "spec", "*", "core", ".", "ServiceSpec", ")", "*", "ofnet", ".", "ServiceSpec", "{", "pSpec", ":=", "make", "(", "[", "]", "ofnet", ".", "PortSpec", ",", "len", "(", "spec", ".", "Ports", ")", ")", "\n", "for", "ix", ","...
// convSvcSpec converts core.ServiceSpec to ofnet.ServiceSpec
[ "convSvcSpec", "converts", "core", ".", "ServiceSpec", "to", "ofnet", ".", "ServiceSpec" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/drivers/ovsd/ovsdriver.go#L672-L685
7,994
contiv/netplugin
drivers/ovsd/ovsdriver.go
AddSvcSpec
func (d *OvsDriver) AddSvcSpec(svcName string, spec *core.ServiceSpec) error { log.Infof("AddSvcSpec: %s", svcName) ss := convSvcSpec(spec) errs := "" for _, sw := range d.switchDb { log.Infof("sw AddSvcSpec: %s", svcName) err := sw.AddSvcSpec(svcName, ss) if err != nil { errs += err.Error() } } err :...
go
func (d *OvsDriver) AddSvcSpec(svcName string, spec *core.ServiceSpec) error { log.Infof("AddSvcSpec: %s", svcName) ss := convSvcSpec(spec) errs := "" for _, sw := range d.switchDb { log.Infof("sw AddSvcSpec: %s", svcName) err := sw.AddSvcSpec(svcName, ss) if err != nil { errs += err.Error() } } err :...
[ "func", "(", "d", "*", "OvsDriver", ")", "AddSvcSpec", "(", "svcName", "string", ",", "spec", "*", "core", ".", "ServiceSpec", ")", "error", "{", "log", ".", "Infof", "(", "\"", "\"", ",", "svcName", ")", "\n", "ss", ":=", "convSvcSpec", "(", "spec",...
// AddSvcSpec invokes switch api
[ "AddSvcSpec", "invokes", "switch", "api" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/drivers/ovsd/ovsdriver.go#L688-L712
7,995
contiv/netplugin
drivers/ovsd/ovsdriver.go
DelSvcSpec
func (d *OvsDriver) DelSvcSpec(svcName string, spec *core.ServiceSpec) error { ss := convSvcSpec(spec) errs := "" for _, sw := range d.switchDb { err := sw.DelSvcSpec(svcName, ss) if err != nil { errs += err.Error() } } err := d.HostProxy.DelSvcSpec(svcName, spec) if err != nil { errs += err.Error() ...
go
func (d *OvsDriver) DelSvcSpec(svcName string, spec *core.ServiceSpec) error { ss := convSvcSpec(spec) errs := "" for _, sw := range d.switchDb { err := sw.DelSvcSpec(svcName, ss) if err != nil { errs += err.Error() } } err := d.HostProxy.DelSvcSpec(svcName, spec) if err != nil { errs += err.Error() ...
[ "func", "(", "d", "*", "OvsDriver", ")", "DelSvcSpec", "(", "svcName", "string", ",", "spec", "*", "core", ".", "ServiceSpec", ")", "error", "{", "ss", ":=", "convSvcSpec", "(", "spec", ")", "\n", "errs", ":=", "\"", "\"", "\n", "for", "_", ",", "s...
// DelSvcSpec invokes switch api
[ "DelSvcSpec", "invokes", "switch", "api" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/drivers/ovsd/ovsdriver.go#L715-L737
7,996
contiv/netplugin
drivers/ovsd/ovsdriver.go
GetEndpointStats
func (d *OvsDriver) GetEndpointStats() ([]byte, error) { vxlanStats, err := d.switchDb["vxlan"].GetEndpointStats() if err != nil { log.Errorf("Error getting vxlan stats. Err: %v", err) return []byte{}, err } vlanStats, err := d.switchDb["vlan"].GetEndpointStats() if err != nil { log.Errorf("Error getting vl...
go
func (d *OvsDriver) GetEndpointStats() ([]byte, error) { vxlanStats, err := d.switchDb["vxlan"].GetEndpointStats() if err != nil { log.Errorf("Error getting vxlan stats. Err: %v", err) return []byte{}, err } vlanStats, err := d.switchDb["vlan"].GetEndpointStats() if err != nil { log.Errorf("Error getting vl...
[ "func", "(", "d", "*", "OvsDriver", ")", "GetEndpointStats", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "vxlanStats", ",", "err", ":=", "d", ".", "switchDb", "[", "\"", "\"", "]", ".", "GetEndpointStats", "(", ")", "\n", "if", "err", ...
// GetEndpointStats gets all endpoints from all ovs instances
[ "GetEndpointStats", "gets", "all", "endpoints", "from", "all", "ovs", "instances" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/drivers/ovsd/ovsdriver.go#L749-L774
7,997
contiv/netplugin
drivers/ovsd/ovsdriver.go
InspectState
func (d *OvsDriver) InspectState() ([]byte, error) { driverState := make(map[string]interface{}) // get vlan switch state vlanState, err := d.switchDb["vlan"].InspectState() if err != nil { return []byte{}, err } // get vxlan switch state vxlanState, err := d.switchDb["vxlan"].InspectState() if err != nil {...
go
func (d *OvsDriver) InspectState() ([]byte, error) { driverState := make(map[string]interface{}) // get vlan switch state vlanState, err := d.switchDb["vlan"].InspectState() if err != nil { return []byte{}, err } // get vxlan switch state vxlanState, err := d.switchDb["vxlan"].InspectState() if err != nil {...
[ "func", "(", "d", "*", "OvsDriver", ")", "InspectState", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "driverState", ":=", "make", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n\n", "// get vlan switch state", "vlanState", ...
// InspectState returns driver state as json string
[ "InspectState", "returns", "driver", "state", "as", "json", "string" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/drivers/ovsd/ovsdriver.go#L777-L804
7,998
contiv/netplugin
drivers/ovsd/ovsdriver.go
InspectBgp
func (d *OvsDriver) InspectBgp() ([]byte, error) { // get vlan switch state bgpState, err := d.switchDb["vlan"].InspectBgp() if err != nil { return []byte{}, err } // json marshall the map jsonState, err := json.Marshal(bgpState) if err != nil { log.Errorf("Error encoding epstats. Err: %v", err) return [...
go
func (d *OvsDriver) InspectBgp() ([]byte, error) { // get vlan switch state bgpState, err := d.switchDb["vlan"].InspectBgp() if err != nil { return []byte{}, err } // json marshall the map jsonState, err := json.Marshal(bgpState) if err != nil { log.Errorf("Error encoding epstats. Err: %v", err) return [...
[ "func", "(", "d", "*", "OvsDriver", ")", "InspectBgp", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "// get vlan switch state", "bgpState", ",", "err", ":=", "d", ".", "switchDb", "[", "\"", "\"", "]", ".", "InspectBgp", "(", ")", "\n", ...
// InspectBgp returns bgp state as json string
[ "InspectBgp", "returns", "bgp", "state", "as", "json", "string" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/drivers/ovsd/ovsdriver.go#L807-L823
7,999
contiv/netplugin
drivers/ovsd/ovsdriver.go
GlobalConfigUpdate
func (d *OvsDriver) GlobalConfigUpdate(inst core.InstanceInfo) error { // convert the netplugin config to ofnet config // currently, its only ArpMode var cfg ofnet.OfnetGlobalConfig switch inst.ArpMode { case "flood": cfg.ArpMode = ofnet.ArpFlood default: // set the default to proxy for graceful upgrade cfg...
go
func (d *OvsDriver) GlobalConfigUpdate(inst core.InstanceInfo) error { // convert the netplugin config to ofnet config // currently, its only ArpMode var cfg ofnet.OfnetGlobalConfig switch inst.ArpMode { case "flood": cfg.ArpMode = ofnet.ArpFlood default: // set the default to proxy for graceful upgrade cfg...
[ "func", "(", "d", "*", "OvsDriver", ")", "GlobalConfigUpdate", "(", "inst", "core", ".", "InstanceInfo", ")", "error", "{", "// convert the netplugin config to ofnet config", "// currently, its only ArpMode", "var", "cfg", "ofnet", ".", "OfnetGlobalConfig", "\n", "switc...
// GlobalConfigUpdate sets the global level configs like arp-mode
[ "GlobalConfigUpdate", "sets", "the", "global", "level", "configs", "like", "arp", "-", "mode" ]
965773066d2b8ebed3514979949061a03d46fd20
https://github.com/contiv/netplugin/blob/965773066d2b8ebed3514979949061a03d46fd20/drivers/ovsd/ovsdriver.go#L826-L850