anchor dict | positive dict | negative dict |
|---|---|---|
{
"audio": "",
"image": "",
"text": "func CreatePolicy(obj *Policy) error {\n\t// Validate parameters\n\terr := ValidatePolicy(obj)\n\tif err != nil {\n\t\tlog.Errorf(\"ValidatePolicy retruned error for: %+v. Err: %v\", obj, err)\n\t\treturn err\n\t}\n\n\t// Check if we handle this object\n\tif objCallbackHandler... | {
"audio": "",
"image": "",
"text": "\t\t// Perform Create callback\n\t\terr = objCallbackHandler.PolicyCb.PolicyCreate(obj)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"PolicyCreate retruned error for: %+v. Err: %v\", obj, err)\n\t\t\tcollections.policyMutex.Lock()\n\t\t\tdelete(collections.policys, obj.Key)\n\t\t\t... | {
"audio": "",
"image": "",
"text": "\t\t// Perform Create callback\n\t\terr = objCallbackHandler.EndpointGroupCb.EndpointGroupCreate(obj)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"EndpointGroupCreate retruned error for: %+v. Err: %v\", obj, err)\n\t\t\tcollections.endpointGroupMutex.Lock()\n\t\t\tdelete(collectio... |
{
"audio": "",
"image": "",
"text": "func FindPolicy(key string) *Policy {\n\tcollections.policyMutex.Lock()\n\tdefer collections.policyMutex.Unlock()\n\n\tobj",
"video": ""
} | {
"audio": "",
"image": "",
"text": " := collections.policys[key]\n\tif obj == nil {\n\t\treturn nil\n\t}\n\n\treturn obj\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\t// Perform Create callback\n\t\terr = objCallbackHandler.EndpointGroupCb.EndpointGroupCreate(obj)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"EndpointGroupCreate retruned error for: %+v. Err: %v\", obj, err)\n\t\t\tcollections.endpointGroupMutex.Lock()\n\t\t\tdelete(collectio... |
{
"audio": "",
"image": "",
"text": "func DeletePolicy(key string) error {\n\tcollections.policyMutex.Lock()\n\tobj := collections.policys[key]\n\tcollections.policyMutex.Unlock()\n\tif obj == nil {\n\t\tlog.Errorf(\"policy %s not found\", key)\n\t\treturn errors.New(\"policy not found\")\n\t}\n\n\t// Check if we... | {
"audio": "",
"image": "",
"text": "\t}\n\n\t// delete it from modeldb\n\tcollections.policyMutex.Lock()\n\terr = obj.Delete()\n\tcollections.policyMutex.Unlock()\n\tif err != nil {\n\t\tlog.Errorf(\"Error deleting policy %s. Err: %v\", obj.Key, err)\n\t}\n\n\t// delete it from cache\n\tcollections.policyMutex.L... | {
"audio": "",
"image": "",
"text": "\t\t// Perform Create callback\n\t\terr = objCallbackHandler.EndpointGroupCb.EndpointGroupCreate(obj)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"EndpointGroupCreate retruned error for: %+v. Err: %v\", obj, err)\n\t\t\tcollections.endpointGroupMutex.Lock()\n\t\t\tdelete(collectio... |
{
"audio": "",
"image": "",
"text": "func ValidatePolicy(obj *Policy) error {\n\tcollections.policyMutex.Lock()\n\tdefer collections.policyMutex.Unlock()\n\n\t// Validate key is correct\n\tkeyStr := obj.TenantName + \":\" + obj.PolicyName\n\tif obj.Key != keyStr {\n\t\tlog.Errorf(\"Expecting Policy Key: %s. Got: ... | {
"audio": "",
"image": "",
"text": "\n\t}\n\n\tif len(obj.TenantName) > 64 {\n\t\treturn errors.New(\"tenantName string too long\")\n\t}\n\n\ttenantNameMatch := regexp.MustCompile(\"^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])$\")\n\tif tenan... | {
"audio": "",
"image": "",
"text": " collections.Bgps[key]\n\tif obj == nil {\n\t\treturn nil\n\t}\n\n\treturn obj\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func CreateRule(obj *Rule) error {\n\t// Validate parameters\n\terr := ValidateRule(obj)\n\tif err != nil {\n\t\tlog.Errorf(\"ValidateRule retruned error for: %+v. Err: %v\", obj, err)\n\t\treturn err\n\t}\n\n\t// Check if we handle this object\n\tif objCallbackHandler.RuleCb ... | {
"audio": "",
"image": "",
"text": "\t\t// Perform Create callback\n\t\terr = objCallbackHandler.RuleCb.RuleCreate(obj)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"RuleCreate retruned error for: %+v. Err: %v\", obj, err)\n\t\t\tcollections.ruleMutex.Lock()\n\t\t\tdelete(collections.rules, obj.Key)\n\t\t\tcollection... | {
"audio": "",
"image": "",
"text": "\t\t// Perform Create callback\n\t\terr = objCallbackHandler.EndpointGroupCb.EndpointGroupCreate(obj)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"EndpointGroupCreate retruned error for: %+v. Err: %v\", obj, err)\n\t\t\tcollections.endpointGroupMutex.Lock()\n\t\t\tdelete(collectio... |
{
"audio": "",
"image": "",
"text": "func FindRule(key string) *Rule {\n\tcollections.ruleMutex.Lock()\n\tdefer collections.ruleMutex.Unlock()\n\n\tobj :=",
"video": ""
} | {
"audio": "",
"image": "",
"text": " collections.rules[key]\n\tif obj == nil {\n\t\treturn nil\n\t}\n\n\treturn obj\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\t// Perform Create callback\n\t\terr = objCallbackHandler.EndpointGroupCb.EndpointGroupCreate(obj)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"EndpointGroupCreate retruned error for: %+v. Err: %v\", obj, err)\n\t\t\tcollections.endpointGroupMutex.Lock()\n\t\t\tdelete(collectio... |
{
"audio": "",
"image": "",
"text": "func DeleteRule(key string) error {\n\tcollections.ruleMutex.Lock()\n\tobj := collections.rules[key]\n\tcollections.ruleMutex.Unlock()\n\tif obj == nil {\n\t\tlog.Errorf(\"rule %s not found\", key)\n\t\treturn errors.New(\"rule not found\")\n\t}\n\n\t// Check if we handle this... | {
"audio": "",
"image": "",
"text": "\t}\n\n\t// delete it from modeldb\n\tcollections.ruleMutex.Lock()\n\terr = obj.Delete()\n\tcollections.ruleMutex.Unlock()\n\tif err != nil {\n\t\tlog.Errorf(\"Error deleting rule %s. Err: %v\", obj.Key, err)\n\t}\n\n\t// delete it from cache\n\tcollections.ruleMutex.Lock()\n\... | {
"audio": "",
"image": "",
"text": "\t\t// Perform Create callback\n\t\terr = objCallbackHandler.EndpointGroupCb.EndpointGroupCreate(obj)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"EndpointGroupCreate retruned error for: %+v. Err: %v\", obj, err)\n\t\t\tcollections.endpointGroupMutex.Lock()\n\t\t\tdelete(collectio... |
{
"audio": "",
"image": "",
"text": "func ValidateRule(obj *Rule) error {\n\tcollections.ruleMutex.Lock()\n\tdefer collections.ruleMutex.Unlock()\n\n\t// Validate key is correct\n\tkeyStr := obj.TenantName + \":\" + obj.PolicyName + \":\" + obj.RuleID\n\tif obj.Key != keyStr {\n\t\tlog.Errorf(\"Expecting Rule Key... | {
"audio": "",
"image": "",
"text": " regexp.MustCompile(\"^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])$\")\n\tif ruleIdMatch.MatchString(obj.RuleID) == false {\n\t\treturn errors.New(\"ruleId string invalid format\")\n\t}\n\n\tif len(obj.Tena... | {
"audio": "",
"image": "",
"text": " collections.Bgps[key]\n\tif obj == nil {\n\t\treturn nil\n\t}\n\n\treturn obj\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func GetOperServiceLB(obj *ServiceLBInspect) error {\n\t// Check if we handle this object\n\tif objCallbackHandler.ServiceLBCb == nil {\n\t\tlog.Errorf(\"No callback registered for serviceLB object\")",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\treturn errors.New(\"Invalid object type\")\n\t}\n\n\t// Perform callback\n\terr := objCallbackHandler.ServiceLBCb.ServiceLBGetOper(obj)\n\tif err != nil {\n\t\tlog.Errorf(\"ServiceLBDelete retruned error for: %+v. Err: %v\", obj, err)\n\t\treturn err\n\t}\n\n\treturn nil... | {
"audio": "",
"image": "",
"text": "\t\t// Perform Create callback\n\t\terr = objCallbackHandler.EndpointGroupCb.EndpointGroupCreate(obj)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"EndpointGroupCreate retruned error for: %+v. Err: %v\", obj, err)\n\t\t\tcollections.endpointGroupMutex.Lock()\n\t\t\tdelete(collectio... |
{
"audio": "",
"image": "",
"text": "func CreateServiceLB(obj *ServiceLB) error {\n\t// Validate parameters\n\terr := ValidateServiceLB(obj)\n\tif err != nil {\n\t\tlog.Errorf(\"ValidateServiceLB retruned error for: %+v. Err: %v\", obj, err)\n\t\treturn err\n\t}\n\n\t// Check if we handle this object\n\tif objCal... | {
"audio": "",
"image": "",
"text": "\t\t// Perform Create callback\n\t\terr = objCallbackHandler.ServiceLBCb.ServiceLBCreate(obj)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"ServiceLBCreate retruned error for: %+v. Err: %v\", obj, err)\n\t\t\tcollections.serviceLBMutex.Lock()\n\t\t\tdelete(collections.serviceLBs, o... | {
"audio": "",
"image": "",
"text": "\t\t// Perform Create callback\n\t\terr = objCallbackHandler.EndpointGroupCb.EndpointGroupCreate(obj)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"EndpointGroupCreate retruned error for: %+v. Err: %v\", obj, err)\n\t\t\tcollections.endpointGroupMutex.Lock()\n\t\t\tdelete(collectio... |
{
"audio": "",
"image": "",
"text": "func FindServiceLB(key string) *ServiceLB {\n\tcollections.serviceLBMutex.Lock()\n\tdefer collections.serviceLBMutex.Unlock()\n\n\tobj",
"video": ""
} | {
"audio": "",
"image": "",
"text": " := collections.serviceLBs[key]\n\tif obj == nil {\n\t\treturn nil\n\t}\n\n\treturn obj\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\t// Perform Create callback\n\t\terr = objCallbackHandler.EndpointGroupCb.EndpointGroupCreate(obj)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"EndpointGroupCreate retruned error for: %+v. Err: %v\", obj, err)\n\t\t\tcollections.endpointGroupMutex.Lock()\n\t\t\tdelete(collectio... |
{
"audio": "",
"image": "",
"text": "func DeleteServiceLB(key string) error {\n\tcollections.serviceLBMutex.Lock()\n\tobj := collections.serviceLBs[key]\n\tcollections.serviceLBMutex.Unlock()\n\tif obj == nil {\n\t\tlog.Errorf(\"serviceLB %s not found\", key)\n\t\treturn errors.New(\"serviceLB not found\")\n\t}\n... | {
"audio": "",
"image": "",
"text": "\treturn err\n\t}\n\n\t// delete it from modeldb\n\tcollections.serviceLBMutex.Lock()\n\terr = obj.Delete()\n\tcollections.serviceLBMutex.Unlock()\n\tif err != nil {\n\t\tlog.Errorf(\"Error deleting serviceLB %s. Err: %v\", obj.Key, err)\n\t}\n\n\t// delete it from cache\n\tco... | {
"audio": "",
"image": "",
"text": "\t\t// Perform Create callback\n\t\terr = objCallbackHandler.EndpointGroupCb.EndpointGroupCreate(obj)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"EndpointGroupCreate retruned error for: %+v. Err: %v\", obj, err)\n\t\t\tcollections.endpointGroupMutex.Lock()\n\t\t\tdelete(collectio... |
{
"audio": "",
"image": "",
"text": "func ValidateServiceLB(obj *ServiceLB) error {\n\tcollections.serviceLBMutex.Lock()\n\tdefer collections.serviceLBMutex.Unlock()\n\n\t// Validate key is correct\n\tkeyStr := obj.TenantName + \":\" + obj.ServiceName\n\tif obj.Key != keyStr {\n\t\tlog.Errorf(\"Expecting ServiceL... | {
"audio": "",
"image": "",
"text": " > 256 {\n\t\treturn errors.New(\"serviceName string too long\")\n\t}\n\n\tserviceNameMatch := regexp.MustCompile(\"^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])$\")\n\tif serviceNameMatch.MatchString(obj.Se... | {
"audio": "",
"image": "",
"text": " collections.Bgps[key]\n\tif obj == nil {\n\t\treturn nil\n\t}\n\n\treturn obj\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func GetOperTenant(obj *TenantInspect) error {\n\t// Check if we handle this object\n\tif objCallbackHandler.TenantCb == nil {\n\t\tlog.Errorf(\"No callback registered for tenant object\")",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\treturn errors.New(\"Invalid object type\")\n\t}\n\n\t// Perform callback\n\terr := objCallbackHandler.TenantCb.TenantGetOper(obj)\n\tif err != nil {\n\t\tlog.Errorf(\"TenantDelete retruned error for: %+v. Err: %v\", obj, err)\n\t\treturn err\n\t}\n\n\treturn nil\n}",
"... | {
"audio": "",
"image": "",
"text": "\t\t// Perform Create callback\n\t\terr = objCallbackHandler.EndpointGroupCb.EndpointGroupCreate(obj)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"EndpointGroupCreate retruned error for: %+v. Err: %v\", obj, err)\n\t\t\tcollections.endpointGroupMutex.Lock()\n\t\t\tdelete(collectio... |
{
"audio": "",
"image": "",
"text": "func CreateTenant(obj *Tenant) error {\n\t// Validate parameters\n\terr := ValidateTenant(obj)\n\tif err != nil {\n\t\tlog.Errorf(\"ValidateTenant retruned error for: %+v. Err: %v\", obj, err)\n\t\treturn err\n\t}\n\n\t// Check if we handle this object\n\tif objCallbackHandler... | {
"audio": "",
"image": "",
"text": "\t\t// Perform Create callback\n\t\terr = objCallbackHandler.TenantCb.TenantCreate(obj)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"TenantCreate retruned error for: %+v. Err: %v\", obj, err)\n\t\t\tcollections.tenantMutex.Lock()\n\t\t\tdelete(collections.tenants, obj.Key)\n\t\t\t... | {
"audio": "",
"image": "",
"text": "\t\t// Perform Create callback\n\t\terr = objCallbackHandler.EndpointGroupCb.EndpointGroupCreate(obj)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"EndpointGroupCreate retruned error for: %+v. Err: %v\", obj, err)\n\t\t\tcollections.endpointGroupMutex.Lock()\n\t\t\tdelete(collectio... |
{
"audio": "",
"image": "",
"text": "func FindTenant(key string) *Tenant {\n\tcollections.tenantMutex.Lock()\n\tdefer collections.tenantMutex.Unlock()\n\n\tobj",
"video": ""
} | {
"audio": "",
"image": "",
"text": " := collections.tenants[key]\n\tif obj == nil {\n\t\treturn nil\n\t}\n\n\treturn obj\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\t// Perform Create callback\n\t\terr = objCallbackHandler.EndpointGroupCb.EndpointGroupCreate(obj)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"EndpointGroupCreate retruned error for: %+v. Err: %v\", obj, err)\n\t\t\tcollections.endpointGroupMutex.Lock()\n\t\t\tdelete(collectio... |
{
"audio": "",
"image": "",
"text": "func DeleteTenant(key string) error {\n\tcollections.tenantMutex.Lock()\n\tobj := collections.tenants[key]\n\tcollections.tenantMutex.Unlock()\n\tif obj == nil {\n\t\tlog.Errorf(\"tenant %s not found\", key)\n\t\treturn errors.New(\"tenant not found\")\n\t}\n\n\t// Check if we... | {
"audio": "",
"image": "",
"text": "\t}\n\n\t// delete it from modeldb\n\tcollections.tenantMutex.Lock()\n\terr = obj.Delete()\n\tcollections.tenantMutex.Unlock()\n\tif err != nil {\n\t\tlog.Errorf(\"Error deleting tenant %s. Err: %v\", obj.Key, err)\n\t}\n\n\t// delete it from cache\n\tcollections.tenantMutex.L... | {
"audio": "",
"image": "",
"text": "\t\t// Perform Create callback\n\t\terr = objCallbackHandler.EndpointGroupCb.EndpointGroupCreate(obj)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"EndpointGroupCreate retruned error for: %+v. Err: %v\", obj, err)\n\t\t\tcollections.endpointGroupMutex.Lock()\n\t\t\tdelete(collectio... |
{
"audio": "",
"image": "",
"text": "func ValidateTenant(obj *Tenant) error {\n\tcollections.tenantMutex.Lock()\n\tdefer collections.tenantMutex.Unlock()\n\n\t// Validate key is correct\n\tkeyStr := obj.TenantName\n\tif obj.Key != keyStr {\n\t\tlog.Errorf(\"Expecting Tenant Key: %s. Got: %s\", keyStr, obj.Key)\n\... | {
"audio": "",
"image": "",
"text": "\n\tif len(obj.TenantName) > 64 {\n\t\treturn errors.New(\"tenantName string too long\")\n\t}\n\n\ttenantNameMatch := regexp.MustCompile(\"^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])$\")\n\tif tenantNameMa... | {
"audio": "",
"image": "",
"text": " collections.Bgps[key]\n\tif obj == nil {\n\t\treturn nil\n\t}\n\n\treturn obj\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func CreateVolume(obj *Volume) error {\n\t// Validate parameters\n\terr := ValidateVolume(obj)\n\tif err != nil {\n\t\tlog.Errorf(\"ValidateVolume retruned error for: %+v. Err: %v\", obj, err)\n\t\treturn err\n\t}\n\n\t// Check if we handle this object\n\tif objCallbackHandler... | {
"audio": "",
"image": "",
"text": "\t\t// Perform Create callback\n\t\terr = objCallbackHandler.VolumeCb.VolumeCreate(obj)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"VolumeCreate retruned error for: %+v. Err: %v\", obj, err)\n\t\t\tcollections.volumeMutex.Lock()\n\t\t\tdelete(collections.volumes, obj.Key)\n\t\t\t... | {
"audio": "",
"image": "",
"text": "\t\t// Perform Create callback\n\t\terr = objCallbackHandler.EndpointGroupCb.EndpointGroupCreate(obj)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"EndpointGroupCreate retruned error for: %+v. Err: %v\", obj, err)\n\t\t\tcollections.endpointGroupMutex.Lock()\n\t\t\tdelete(collectio... |
{
"audio": "",
"image": "",
"text": "func FindVolume(key string) *Volume {\n\tcollections.volumeMutex.Lock()\n\tdefer collections.volumeMutex.Unlock()\n\n\tobj",
"video": ""
} | {
"audio": "",
"image": "",
"text": " := collections.volumes[key]\n\tif obj == nil {\n\t\treturn nil\n\t}\n\n\treturn obj\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\t// Perform Create callback\n\t\terr = objCallbackHandler.EndpointGroupCb.EndpointGroupCreate(obj)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"EndpointGroupCreate retruned error for: %+v. Err: %v\", obj, err)\n\t\t\tcollections.endpointGroupMutex.Lock()\n\t\t\tdelete(collectio... |
{
"audio": "",
"image": "",
"text": "func DeleteVolume(key string) error {\n\tcollections.volumeMutex.Lock()\n\tobj := collections.volumes[key]\n\tcollections.volumeMutex.Unlock()\n\tif obj == nil {\n\t\tlog.Errorf(\"volume %s not found\", key)\n\t\treturn errors.New(\"volume not found\")\n\t}\n\n\t// Check if we... | {
"audio": "",
"image": "",
"text": "\t}\n\n\t// delete it from modeldb\n\tcollections.volumeMutex.Lock()\n\terr = obj.Delete()\n\tcollections.volumeMutex.Unlock()\n\tif err != nil {\n\t\tlog.Errorf(\"Error deleting volume %s. Err: %v\", obj.Key, err)\n\t}\n\n\t// delete it from cache\n\tcollections.volumeMutex.L... | {
"audio": "",
"image": "",
"text": "\t\t// Perform Create callback\n\t\terr = objCallbackHandler.EndpointGroupCb.EndpointGroupCreate(obj)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"EndpointGroupCreate retruned error for: %+v. Err: %v\", obj, err)\n\t\t\tcollections.endpointGroupMutex.Lock()\n\t\t\tdelete(collectio... |
{
"audio": "",
"image": "",
"text": "func ValidateVolume(obj *Volume) error {\n\tcollections.volumeMutex.Lock()\n\tdefer collections.volumeMutex.Unlock()\n\n\t// Validate key is correct\n\tkeyStr :=",
"video": ""
} | {
"audio": "",
"image": "",
"text": " obj.TenantName + \":\" + obj.VolumeName\n\tif obj.Key != keyStr {\n\t\tlog.Errorf(\"Expecting Volume Key: %s. Got: %s\", keyStr, obj.Key)\n\t\treturn errors.New(\"Invalid Key\")\n\t}\n\n\t// Validate each field\n\n\treturn nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\t// Perform Create callback\n\t\terr = objCallbackHandler.EndpointGroupCb.EndpointGroupCreate(obj)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"EndpointGroupCreate retruned error for: %+v. Err: %v\", obj, err)\n\t\t\tcollections.endpointGroupMutex.Lock()\n\t\t\tdelete(collectio... |
{
"audio": "",
"image": "",
"text": "func CreateVolumeProfile(obj *VolumeProfile) error {\n\t// Validate parameters\n\terr := ValidateVolumeProfile(obj)\n\tif err != nil {\n\t\tlog.Errorf(\"ValidateVolumeProfile retruned error for: %+v. Err: %v\", obj, err)\n\t\treturn err\n\t}\n\n\t// Check if we handle this obj... | {
"audio": "",
"image": "",
"text": "\t\t// Perform Create callback\n\t\terr = objCallbackHandler.VolumeProfileCb.VolumeProfileCreate(obj)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"VolumeProfileCreate retruned error for: %+v. Err: %v\", obj, err)\n\t\t\tcollections.volumeProfileMutex.Lock()\n\t\t\tdelete(collectio... | {
"audio": "",
"image": "",
"text": "\t\t// Perform Create callback\n\t\terr = objCallbackHandler.EndpointGroupCb.EndpointGroupCreate(obj)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"EndpointGroupCreate retruned error for: %+v. Err: %v\", obj, err)\n\t\t\tcollections.endpointGroupMutex.Lock()\n\t\t\tdelete(collectio... |
{
"audio": "",
"image": "",
"text": "func FindVolumeProfile(key string) *VolumeProfile {\n\tcollections.volumeProfileMutex.Lock()",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tdefer collections.volumeProfileMutex.Unlock()\n\n\tobj := collections.volumeProfiles[key]\n\tif obj == nil {\n\t\treturn nil\n\t}\n\n\treturn obj\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\t// Perform Create callback\n\t\terr = objCallbackHandler.EndpointGroupCb.EndpointGroupCreate(obj)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"EndpointGroupCreate retruned error for: %+v. Err: %v\", obj, err)\n\t\t\tcollections.endpointGroupMutex.Lock()\n\t\t\tdelete(collectio... |
{
"audio": "",
"image": "",
"text": "func DeleteVolumeProfile(key string) error {\n\tcollections.volumeProfileMutex.Lock()\n\tobj := collections.volumeProfiles[key]\n\tcollections.volumeProfileMutex.Unlock()\n\tif obj == nil {\n\t\tlog.Errorf(\"volumeProfile %s not found\", key)\n\t\treturn errors.New(\"volumePro... | {
"audio": "",
"image": "",
"text": "\treturn err\n\t}\n\n\t// delete it from modeldb\n\tcollections.volumeProfileMutex.Lock()\n\terr = obj.Delete()\n\tcollections.volumeProfileMutex.Unlock()\n\tif err != nil {\n\t\tlog.Errorf(\"Error deleting volumeProfile %s. Err: %v\", obj.Key, err)\n\t}\n\n\t// delete it from... | {
"audio": "",
"image": "",
"text": "\t\t// Perform Create callback\n\t\terr = objCallbackHandler.EndpointGroupCb.EndpointGroupCreate(obj)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"EndpointGroupCreate retruned error for: %+v. Err: %v\", obj, err)\n\t\t\tcollections.endpointGroupMutex.Lock()\n\t\t\tdelete(collectio... |
{
"audio": "",
"image": "",
"text": "func ValidateVolumeProfile(obj *VolumeProfile) error {\n\tcollections.volumeProfileMutex.Lock()\n\tdefer collections.volumeProfileMutex.Unlock()\n\n\t// Validate key is correct\n\tkeyStr := obj.TenantName + \":\" + obj.VolumeProfileName\n\tif obj.Key != keyStr {\n\t\tlog.Error... | {
"audio": "",
"image": "",
"text": " VolumeProfile Key: %s. Got: %s\", keyStr, obj.Key)\n\t\treturn errors.New(\"Invalid Key\")\n\t}\n\n\t// Validate each field\n\n\treturn nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " collections.Bgps[key]\n\tif obj == nil {\n\t\treturn nil\n\t}\n\n\treturn obj\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func NewAgent(pluginConfig *plugin.Config) *Agent {\n\topts := pluginConfig.Instance\n\tnetPlugin := &plugin.NetPlugin{}\n\n\t// init cluster state\n\terr := cluster.Init(pluginConfig.Drivers.State, []string{opts.DbURL})\n\tif err != nil {\n\t\tlog.Fatalf(\"Error initializing ... | {
"audio": "",
"image": "",
"text": "\n\tcase core.Test:\n\t\t// nothing to do. internal mode for testing\n\tdefault:\n\t\tlog.Fatalf(\"Unknown plugin mode -- should be %s | %s | %s\",\n\t\t\tcore.Docker, core.SwarmMode, core.Kubernetes)\n\t}\n\t// init mesos plugin\n\tmesosplugin.InitPlugin(netPlugin)\n\n\t// cr... | {
"audio": "",
"image": "",
"text": " init admission plugin %q: %v\", name, err)\n\t}\n\tif !found {\n\t\treturn nil, fmt.Errorf(\"unknown admission plugin: %s\", name)\n\t}\n\n\tpluginInitializer.Initialize(plugin)\n\t// ensure that plugins have been properly initialized\n\tif err := ValidateInitialization(plugi... |
{
"audio": "",
"image": "",
"text": "func (ag *Agent) ProcessCurrentState() error {\n\topts := ag.pluginConfig.Instance\n\treadNet := &mastercfg.CfgNetworkState{}\n\treadNet.StateDriver = ag.netPlugin.StateDriver\n\tnetCfgs, err := readNet.ReadAll()\n\tif err == nil {\n\t\tfor idx, netCfg := range netCfgs {\n\t\t... | {
"audio": "",
"image": "",
"text": "\t\tlog.Infof(\"Read epg key[%d] %s, populating state \\n\", idx, epg.GroupName)\n\t\t\tprocessEpgEvent(ag.netPlugin, opts, epg.ID, false)\n\t\t}\n\t}\n\n\treadServiceLb := &mastercfg.CfgServiceLBState{}\n\treadServiceLb.StateDriver = ag.netPlugin.StateDriver\n\tserviceLbCfgs,... | {
"audio": "",
"image": "",
"text": " container '%s' and host '%s'\",\n\t\t\tep.Container, ep.Host)\n\n\t\tfor _, epCfg := range epCfgs {\n\t\t\tcfg := epCfg.(*mastercfg.CfgEndpointState)\n\t\t\tif cfg.EndpointID != ep.Container {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcfg.HomingHost = ep.Host\n\t\t\terr = cfg.Write()... |
{
"audio": "",
"image": "",
"text": "func (ag *Agent) PostInit() error {\n\topts := ag.pluginConfig.Instance\n\n\t// Initialize clustering\n\terr := cluster.RunLoop(ag.netPlugin, opts.CtrlIP, opts.VtepIP, opts.HostLabel)\n\tif err != nil {",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\tlog.Errorf(\"Error starting cluster run loop\")\n\t}\n\n\t// start service REST requests\n\tag.serveRequests()\n\n\treturn nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " Option {\n\treturn func(opts *options) error {\n\t\topts.Service = service\n\t\treturn nil\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (ag *Agent) HandleEvents() error {\n\topts := ag.pluginConfig.Instance\n\trecvErr := make(chan error, 1)\n\n\tgo handleNetworkEvents(ag.netPlugin, opts, recvErr)\n\n\tgo handleBgpEvents(ag.netPlugin, opts, recvErr)\n\n\tgo handleEndpointEvents(ag.netPlugin, opts, recvErr)... | {
"audio": "",
"image": "",
"text": "\n\n\tgo handleGlobalCfgEvents(ag.netPlugin, opts, recvErr)\n\n\tgo handlePolicyRuleEvents(ag.netPlugin, opts, recvErr)\n\n\tif ag.pluginConfig.Instance.PluginMode == core.Docker ||\n\t\tag.pluginConfig.Instance.PluginMode == core.SwarmMode {\n\t\tgo ag.monitorDockerEvents(rec... | {
"audio": "",
"image": "",
"text": " error { return swarm.RunDeploy(dockerCli, opts, config) },\n\t\tfunc(kli *kubernetes.KubeCli) error { return kubernetes.RunDeploy(kli, opts, config) })\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (ag *Agent) serveRequests() {\n\tlistenURL := \":9090\"\n\trouter := mux.NewRouter()\n\n\t// Add REST routes\n\ts := router.Methods(\"GET\").Subrouter()\n\ts.HandleFunc(\"/svcstats\", func(w http.ResponseWriter, r *http.Request) {\n\t\tstats, err := ag.netPlugin.GetEndpoi... | {
"audio": "",
"image": "",
"text": "\t\tns, err := ag.netPlugin.NetworkDriver.InspectNameserver()\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error fetching nameserver state. Err: %v\", err)\n\t\t\thttp.Error(w, \"Error fetching nameserver state\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tw.Write(n... | {
"audio": "",
"image": "",
"text": " func(responseWriter http.ResponseWriter, request *http.Request) {\n\t\thttp.ServeFile(responseWriter, request, filePath)\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (ag *Agent) ReclaimEndpointHandler(w http.ResponseWriter, r *http.Request, vars map[string]string) (interface{}, error) {\n\tepID := vars[\"id\"]\n\t// delete the endpoint\n\terr := ag.netPlugin.DeleteEndpoint(epID)\n\tif err != nil {\n\t\tlog.Errorf(\"Error deleting endp... | {
"audio": "",
"image": "",
"text": " epID, err)\n\t\thttp.Error(w, fmt.Sprintf(\"failed to delete endpoint: %+v\", epID), 0)\n\t\treturn nil, err\n\t}\n\n\treturn nil, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " func(responseWriter http.ResponseWriter, request *http.Request) {\n\t\thttp.ServeFile(responseWriter, request, filePath)\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func applyConfig(cl *contivClient.ContivClient) error {\n\tdata, err := ioutil.ReadFile(configPath())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to read config file: %v\", err)\n\t}\n\n\tnc := Config{}\n\tif err := json.Unmarshal(data, &nc); err != nil {\n\t\treturn fm... | {
"audio": "",
"image": "",
"text": " err)\n\t}\n\n\t// add the token header we use to authenticate\n\tif err := cl.SetAuthToken(nc.Token); err != nil {\n\t\treturn fmt.Errorf(\"failed to set auth token: %v\", err)\n\t}\n\n\treturn nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " != nil {\n\t\t\treturn fmt.Errorf(\"Failed to write row: %v\", err)\n\t\t}\n\t\tif _, err := fprintRow(writer, written, delimiter, row.V...); err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to write row: %v\", err)\n\t\t}\n\n\t\tif _, err := writer.Write([]byte(\"\\n\")); err ... |
{
"audio": "",
"image": "",
"text": "func configPath() string {\n\tvar homeDir string\n\t// this fails for static binaries\n\tusr, err := user.Current()\n\tif err == nil {\n\t\thomeDir = usr.HomeDir\n\t}\n\t// this should work where we don't have static binaries\n\tif err != nil {\n\t\thomeDir = os.Getenv(\"HOME\... | {
"audio": "",
"image": "",
"text": "\n\t}\n\t// panic if we've failed to retrieve the home directory\n\tif homeDir == \"\" {\n\t\tpanic(errHomeDirectoryNotSet)\n\t}\n\n\treturn usr.HomeDir + \"/.netctl/config.json\"\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t}\n\tipfsPath, err := homedir.Expand(ipfsPath)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn ipfsPath, nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func writeConfig(ctx *cli.Context, data []byte) {\n\tdir := filepath.Dir(configPath())\n\n\t// try to create the netctl config directory but ignore \"already exists\" errors.\n\t// only the user should be able to read the contents of this directory\n\tif err := os.Mkdir(dir, 0... | {
"audio": "",
"image": "",
"text": "\terrExit(ctx, exitIO, err.Error(), false)\n\t}\n\n\t// only the user should be able to read the config file\n\tif err := ioutil.WriteFile(configPath(), data, 0600); err != nil {\n\t\terrExit(ctx, exitIO, err.Error(), false)\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\n\t// Make sure the directory exists.\n\tif err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {\n\t\treturn err\n\t}\n\n\t// Marshal the JSON data\n\tdata, err := json.MarshalIndent(p, \"\", \" \")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Write the data to th... |
{
"audio": "",
"image": "",
"text": "func getDockerHost() string {\n\tdockerHost := os.Getenv(\"DOCKER_HOST\")\n\tif dockerHost == \"\" {\n\t\tif runtime.GOOS == \"windows\" {\n\t\t\t// If we do not have a host, default to TCP socket on Windows\n\t\t\tdockerHost = fmt.Sprintf(\"tcp://%s:%d\", DefaultHTTPHost, Def... | {
"audio": "",
"image": "",
"text": "\t\t\t// If we do not have a host, default to unix socket\n\t\t\tdockerHost = fmt.Sprintf(\"unix://%s\", DefaultUnixSocket)\n\t\t}\n\t}\n\treturn dockerHost\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\t\treturn fmt.Errorf(\"missing handler for '%s' capability\", c)\n\t\t}\n\t}\n\tif config.ResourceGroup == \"\" {\n\t\treturn fmt.Errorf(\"missing resource group\")\n\t}\n\tif config.Token == \"\" {\n\t\tconfig.Token = os.Getenv(\"ATLAS_TOKEN\")\n\t}\n\tif config.Token ==... |
{
"audio": "",
"image": "",
"text": "func (ens *NetpluginNameServer) AddLbService(tenant string, name string, v4name string) {\n\tif len(v4name) > 0 {\n\t\tdnsLog.Infof(\"add k8s service %s ip %s\", name, v4name)\n\t\tif tenant == K8sDefaultTenant {\n\t\t\tens.k8sService.Set(name, nameRecord{v4Record: net.ParseIP... | {
"audio": "",
"image": "",
"text": "\tmc := mastercfg.CfgServiceLBState{\n\t\t\t\tTenant: tenant,\n\t\t\t\tServiceName: name,\n\t\t\t\tIPAddress: v4name,\n\t\t\t}\n\t\t\tens.addService(&mc)\n\t\t}\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\treturn net.ParseIP(managementNetwork.Vip)\n\t} else {\n\t\treturn net.ParseIP(managementNetwork.Ip)\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (ens *NetpluginNameServer) DelLbService(tenant string, name string) {\n\n\tdnsLog.Infof(\"delete k8s service %s \", name)\n\tif tenant",
"video": ""
} | {
"audio": "",
"image": "",
"text": " == K8sDefaultTenant {\n\t\tens.k8sService.Remove(name)\n\t} else {\n\t\tmc := mastercfg.CfgServiceLBState{\n\t\t\tTenant: tenant,\n\t\t\tServiceName: name,\n\t\t}\n\t\tens.delService(&mc)\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tallEndpoints[existingEndpoint] = allEndpoints[existingEndpoint] + 1\n\t}\n\tfor mKey, mVal := range allEndpoints {\n\t\tif mVal == 1 {\n\t\t\tklog.V(2).Infof(\"Delete endpoint %s for service %q\", mKey, svcPort)\n\t\t\tremoveSessionAffinityByEndpoint(state, svcPort, mKey)\... |
{
"audio": "",
"image": "",
"text": "func (ens *NetpluginNameServer) InspectState() (interface{}, error) {\n\n\ts := struct {\n\t\tSvcChan int `json:\"serviceQueue\"`\n\t\tEpChan int ",
"video": ""
} | {
"audio": "",
"image": "",
"text": " `json:\"endpointQueue\"`\n\t\tDtbl map[string]map[string]map[string][]string `json:\"dnsRecords\"`\n\t\tStats map[string]map[string]uint64 `json:\"stats\"`\n\t}{SvcChan: len(ens.svcChan), EpChan: len(ens.epChan),\n\t\tDtbl: ens.inspectNameRecord(), St... | {
"audio": "",
"image": "",
"text": " (interface{}, error)) *Init {\n\treturn ini.Branch(func() (interface{}, error) {\n\t\treturn ini.withTimeout(timeout, f)\n\t})\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (ens *NetpluginNameServer) NsLookup(nsq []byte, vrfPtr *string) ([]byte, error) {\n\ttenant := *vrfPtr\n\treq := new(dns.Msg)\n\terr := req.Unpack(nsq)\n\tif err != nil {\n\t\tens.incTenantStats(tenant, \"invalidQuery\")\n\t\treturn nil, err\n\t}\n\n\t// no fancy requests... | {
"audio": "",
"image": "",
"text": " \"invalidQuery\")\n\t\treturn nil, errors.New(\"\")\n\t}\n\n\tif req.IsTsig() != nil {\n\t\tens.incTenantStats(tenant, \"invalidQuery\")\n\t\treturn nil, errors.New(\"\")\n\t}\n\n\td, err := ens.serveNameRecord(tenant, req)\n\tif err != nil {\n\t\tlogrus.Infof(\"no name recor... | {
"audio": "",
"image": "",
"text": " req.onlyMultipartForm() {\n\t\tbody, err := marshalMultipartForm(req.multipartForm, req.multipartFormBoundary)\n\t\tif err != nil {\n\t\t\treturn []byte(err.Error())\n\t\t}\n\t\treturn body\n\t}\n\treturn req.bodyBytes()\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (ens *NetpluginNameServer) Init(sd core.StateDriver) error {\n\tdnsLog = logrus.WithField(\"module\", \"nameserver\")\n\tens.bucketSize = 64\n\tens.stateDriver = sd\n\n\t// don't change buffering\n\tens.epChan = make(chan core.WatchState, 64)\n\tens.epErrChan = make(chan ... | {
"audio": "",
"image": "",
"text": " = make([]tenantBucket, ens.bucketSize)\n\tens.k8sService = cmap.New()\n\n\tfor i := uint(0); i < ens.bucketSize; i++ {\n\t\tens.buckets[i].tenantTables = make(map[string]*dnsTables)\n\t\tens.stats.tenantStats = make(map[string]map[string]uint64)\n\t}\n\tens.epKeyPath = master... | {
"audio": "",
"image": "",
"text": " bufferSize,\n\t\tBuffer: make(chan *Package, bufferSize*2),\n\t\tflushStatus: make(chan chan bool, 1),\n\t\tflushCommand: make(chan bool, bufferSize*2),\n\t}, nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func AddBgp(stateDriver core.StateDriver, bgpCfg *intent.ConfigBgp) error {\n\n\tlog.Infof(\"Adding bgp neighbor {%v}\", bgpCfg)\n\taci, _ := IsAciConfigured()\n\tif aci {\n\t\tlog.Errorf(\"Invalid configuration. Not supported in ACI fabric mode.\")\n\t\treturn errors.New(\"no... | {
"audio": "",
"image": "",
"text": " = bgpCfg.RouterIP\n\tbgpState.As = bgpCfg.As\n\tbgpState.NeighborAs = bgpCfg.NeighborAs\n\tbgpState.Neighbor = bgpCfg.Neighbor\n\tbgpState.StateDriver = stateDriver\n\tbgpState.ID = bgpCfg.Hostname\n\treturn bgpState.Write()\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " Add the Bgp neighbor\n\terr = master.AddBgp(stateDriver, &bgpIntentCfg)\n\tif err != nil {\n\t\tlog.Errorf(\"Error creating Bgp neighbor {%+v}. Err: %v\", NewbgpCfg.Neighbor, err)\n\t\treturn err\n\t}\n\n\toldbgpCfg.Hostname = NewbgpCfg.Hostname\n\toldbgpCfg.Routerip = Newbgp... |
{
"audio": "",
"image": "",
"text": "func DeleteBgp(stateDriver core.StateDriver, hostname string) error {\n\tlog.Infof(\"Deleting bgp neighbor for {%v}\", hostname)\n\tbgpState := &mastercfg.CfgBgpState{}\n\tbgpState.StateDriver = stateDriver\n\terr := bgpState.Read(hostname)\n\tif err != nil {\n\t\tlog.Errorf(\... | {
"audio": "",
"image": "",
"text": " %s\", hostname)\n\t\treturn err\n\t}\n\terr = bgpState.Clear()\n\tif err != nil {\n\t\tlog.Errorf(\"Error deleing Bgp config for hostname %s\", hostname)\n\t\treturn err\n\t}\n\treturn nil\n\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " Add the Bgp neighbor\n\terr = master.AddBgp(stateDriver, &bgpIntentCfg)\n\tif err != nil {\n\t\tlog.Errorf(\"Error creating Bgp neighbor {%+v}. Err: %v\", NewbgpCfg.Neighbor, err)\n\t\treturn err\n\t}\n\n\toldbgpCfg.Hostname = NewbgpCfg.Hostname\n\toldbgpCfg.Routerip = Newbgp... |
{
"audio": "",
"image": "",
"text": "func (ep *EtcdClient) NewLock(name string, myID string, ttl uint64) (LockInterface, error) {\n\twatchCtx, watchCancel := context.WithCancel(context.Background())\n\t// Create a lock\n\treturn &etcdLock{\n\t\tname: name,\n\t\tmyID: myID,\n\t\tttl: time.Dur... | {
"audio": "",
"image": "",
"text": " ep.kapi,\n\t\teventChan: make(chan LockEvent, 1),\n\t\tstopChan: make(chan bool, 1),\n\t\twatchCh: make(chan *client.Response, 1),\n\t\twatchCtx: watchCtx,\n\t\twatchCancel: watchCancel,\n\t\tmutex: new(sync.Mutex),\n\t}, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " (string, string, string, error) {\n\treturn api.SendMessageContext(context.Background(), channelID, MsgOptionUnfurl(timestamp, unfurls), MsgOptionCompose(options...))\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (lk *etcdLock) waitForLock() {\n\t// If timeout is not specified, set it to high value\n\ttimeoutIntvl := time.Second * time.Duration(20000)\n\tif lk.timeout != 0 {\n\t\ttimeoutIntvl = time.Second * time.Duration(lk.timeout)\n\t}\n\n\tlog.Infof(\"Waiting to acquire lock (... | {
"audio": "",
"image": "",
"text": "\t}\n\t\t\tlk.mutex.Unlock()\n\t\tcase watchResp := <-lk.watchCh:\n\t\t\tif watchResp != nil {\n\t\t\t\tlog.Debugf(\"Received watch notification(%s/%s): %+v\", lk.name, lk.myID, watchResp)\n\n\t\t\t\tif watchResp.Action == \"expire\" || watchResp.Action == \"delete\" ||\n\t\t\... | {
"audio": "",
"image": "",
"text": "\tlk.Lock()\n\tfn()\n\tlk.Unlock()\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (lk *etcdLock) watchLock() {\n\tkeyName := \"/contiv.io/lock/\" + lk.name\n\n\twatcher := lk.kapi.Watcher(keyName, nil)\n\tif watcher == nil {\n\t\tlog.Errorf(\"Error creating the watcher\")\n\t\treturn\n\t}\n\tfor {\n\t\tresp, err := watcher.Next(lk.watchCtx)\n\t\tif err... | {
"audio": "",
"image": "",
"text": " key %s, Err %v.\", keyName, err)\n\t\t} else {\n\t\t\tlog.Debugf(\"Got Watch Resp: %+v\", resp)\n\n\t\t\t// send the event to watch channel\n\t\t\tlk.watchCh <- resp\n\t\t}\n\n\t\tlk.mutex.Lock()\n\t\t// If the lock is released, we are done\n\t\tif lk.isReleased {\n\t\t\tlk.m... | {
"audio": "",
"image": "",
"text": "\n\t\tklog.Errorf(\"Received an error from watcher: %s\", err)\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error initializing watcher: %s\", err)\n\t}\n\n\tif err := prober.addWatchRecursive(prober.pluginDir); err != nil {\n\t\treturn fmt.Errorf(\"Error adding watch on F... |
{
"audio": "",
"image": "",
"text": "func initHelper(driverRegistry map[string]driverConfigTypes, driverName string) (core.Driver, error) {\n\tif _, ok := driverRegistry[driverName]; ok {\n\t\tdriverType := driverRegistry[driverName].DriverType\n\n\t",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tdriver := reflect.New(driverType).Interface()\n\t\treturn driver, nil\n\t}\n\n\treturn nil, core.Errorf(\"Failed to find a registered driver for: %s\", driverName)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " newOption := range deprecatedFields {\n\t\tif deprecatedValue, ok := m[deprecatedOption]; ok {\n\t\t\tif _, ok := m[newOption]; !ok {\n\t\t\t\tm[newOption] = deprecatedValue\n\t\t\t}\n\t\t}\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func NewStateDriver(name string, instInfo *core.InstanceInfo) (core.StateDriver, error) {\n\tif name == \"\" || instInfo == nil {\n\t\treturn nil, core.Errorf(\"invalid driver name or configuration passed.\")\n\t}\n\n\tif gStateDriver != nil {\n\t\treturn nil, core.Errorf(\"st... | {
"audio": "",
"image": "",
"text": " initHelper(stateDriverRegistry, name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\td := driver.(core.StateDriver)\n\terr = d.Init(instInfo)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tgStateDriver = d\n\treturn d, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\t\tif provider.Name() == name {\n\t\t\treturn provider, nil\n\t\t}\n\t}\n\n\treturn nil, &common.MissingProviderError{ProviderName: name}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func GetStateDriver() (core.StateDriver, error) {\n\tif gStateDriver ==",
"video": ""
} | {
"audio": "",
"image": "",
"text": " nil {\n\t\treturn nil, core.Errorf(\"statedriver has not been not created.\")\n\t}\n\n\treturn gStateDriver, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " reg core.Registration) (regR core.Registration, err error) {\n\treturn\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func NewNetworkDriver(name string, instInfo *core.InstanceInfo) (core.NetworkDriver, error) {\n\tif name == \"\" || instInfo == nil {\n\t\treturn nil, core.Errorf(\"invalid driver name or configuration passed.\")\n\t}\n\n\tdriver, err := initHelper(networkDriverRegistry, name)... | {
"audio": "",
"image": "",
"text": " {\n\t\treturn nil, err\n\t}\n\n\td := driver.(core.NetworkDriver)\n\terr = d.Init(instInfo)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn d, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\t\tev, err = scope.evalAST(t)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tev.loadValue(cfg)\n\tif ev.Name == \"\" {\n\t\tev.Name = expr\n\t}\n\treturn ev, nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func BuildNetworkFlags(binary string) []cli.Flag {\n\tbinUpper := strings.ToUpper(binary)\n\tbinLower := strings.ToLower(binary)\n\treturn []cli.Flag{\n\t\tcli.StringFlag{\n\t\t\tName: \"mode, plugin-mode, cluster-mode\",\n\t\t\tEnvVar: fmt.Sprintf(\"CONTIV_%s_MODE\", binUpp... | {
"audio": "",
"image": "",
"text": "\t\tUsage: fmt.Sprintf(\"set %s forwarding network mode, options: [bridge, routing]\", binLower),\n\t\t},\n\t\t/*\n\t\t\t// only ovs is supported\n\t\t\t// TODO: turn it on when having more than one backend supported\n\t\t\tcli.StringFlag {\n\t\t\t\tName: \"driver, net-driver... | {
"audio": "",
"image": "",
"text": "\t\t\tUsage: \"Path to TLS certificate file\",\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"tlskey\",\n\t\t\tUsage: \"Path to TLS key file\",\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"configdir\",\n\t\t\tUsage: \"Path to docker config dir, default ${HOME}/.docker\",\n\t\t},... |
{
"audio": "",
"image": "",
"text": "func BuildLogFlags(binary string) []cli.Flag {\n\tbinUpper := strings.ToUpper(binary)\n\tbinLower := strings.ToLower(binary)\n\treturn []cli.Flag{\n\t\tcli.StringFlag{\n\t\t\tName: \"log-level\",\n\t\t\tValue: \"INFO\",\n\t\t\tEnvVar: fmt.Sprintf(\"CONTIV_%s_LOG_LEVEL\", bi... | {
"audio": "",
"image": "",
"text": " \"use-syslog, syslog\",\n\t\t\tEnvVar: fmt.Sprintf(\"CONTIV_%s_USE_SYSLOG\", binUpper),\n\t\t\tUsage: fmt.Sprintf(\"set %s send log to syslog if this flag is provided\", binLower),\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"syslog-url\",\n\t\t\tValue: \"udp://127.0.0.1:5... | {
"audio": "",
"image": "",
"text": "\t\t\tUsage: \"Path to TLS certificate file\",\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"tlskey\",\n\t\t\tUsage: \"Path to TLS key file\",\n\t\t},\n\t\tcli.StringFlag{\n\t\t\tName: \"configdir\",\n\t\t\tUsage: \"Path to docker config dir, default ${HOME}/.docker\",\n\t\t},... |
{
"audio": "",
"image": "",
"text": "func InitLogging(binary string, ctx *cli.Context) error {\n\tlogLevel, err := logrus.ParseLevel(ctx.String(\"log-level\"))\n\tif err != nil {\n\t\treturn err\n\t}\n\tlogrus.SetLevel(logLevel)\n\tlogrus.Infof(\"Using %v log level: %v\", binary, logLevel)\n\n\tif ctx.Bool(\"use-... | {
"audio": "",
"image": "",
"text": "\t}\n\n\tif ctx.Bool(\"use-json-log\") {\n\t\tlogrus.SetFormatter(&logrus.JSONFormatter{})\n\t\tlogrus.Infof(\"Using %v log format: json\", binary)\n\t} else {\n\t\tlogrus.SetFormatter(&logrus.TextFormatter{FullTimestamp: true, TimestampFormat: time.StampNano})\n\t\tlogrus.Inf... | {
"audio": "",
"image": "",
"text": "\t\treturn fmt.Errorf(\"No endpoint to master has been configured\")\n\t\t}\n\t}\n\n\tif options.Master {\n\t\tlog.WithFields(logrus.Fields{\n\t\t\t\"poolid\": options.MasterPoolID,\n\t\t}).Debug(\"Using configured default pool ID\")\n\t}\n\treturn nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func ValidateDBOptions(binary string, ctx *cli.Context) (*DBConfigs, error) {\n\tvar storeDriver string\n\tvar storeURL string\n\tvar storeURLs string\n\tetcdURLs := ctx.String(\"etcd\")\n\tconsulURLs := ctx.String(\"consul\")\n\n\tif etcdURLs != \"\" && consulURLs != \"\" {\n... | {
"audio": "",
"image": "",
"text": " %v endpoint: %v\", binary, storeDriver, endpoint)\n\t\t}\n\t\t// TODO: support multi-endpoints\n\t\tstoreURL = endpoint\n\t\tlogrus.Infof(\"Using %s state db endpoints: %v: %v\", binary, storeDriver, storeURL)\n\t\tbreak\n\t}\n\n\tif storeURL == \"\" {\n\t\treturn nil, fmt.Er... | {
"audio": "",
"image": "",
"text": " && ctx.ignorePattern != \"\" {\n\t\tmatch = !pathMatch(ctx.ignorePattern, path)\n\t}\n\tif match && ctx.namePattern != \"\" {\n\t\tmatch = nameMatch(ctx.namePattern, path)\n\t}\n\tif match && ctx.pathPattern != \"\" {\n\t\tmatch = pathMatch(ctx.pathPattern, path)\n\t}\n\tif m... |
{
"audio": "",
"image": "",
"text": "func ValidateNetworkOptions(binary string, ctx *cli.Context) (*NetworkConfigs, error) {\n\t// 1. validate and set plugin mode\n\tpluginMode := strings.ToLower(ctx.String(\"mode\"))\n\tswitch pluginMode {\n\tcase core.Docker, core.Kubernetes, core.SwarmMode, core.Test:\n\t\tlog... | {
"audio": "",
"image": "",
"text": "\n\t\treturn nil, fmt.Errorf(\"%s forwarding mode is not set\", binary)\n\t} else if networkMode == \"vxlan\" && forwardMode == \"bridge\" {\n\t\treturn nil, fmt.Errorf(\"invalid %s forwarding mode: %q (network mode: %q)\", binary, forwardMode, networkMode)\n\t}\n\t// vxlan/vl... | {
"audio": "",
"image": "",
"text": "\treturn nil, fmt.Errorf(\"AssetInfo %s can't read by error: %v\", name, err)\n\t\t}\n\t\treturn a.info, nil\n\t}\n\treturn nil, fmt.Errorf(\"AssetInfo %s not found\", name)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func FlattenFlags(flagSlices ...[]cli.Flag) []cli.Flag {\n\tvar flags []cli.Flag\n\tfor _, slice := range flagSlices {",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\tflags = append(flags, slice...)\n\t}\n\treturn flags\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " invalid file; it does not count.\n\t\treturn\n\t}\n\n\tif flags := f.FileLocalFlags(); flags == 0 {\n\t\t// Account regular files in the zero-flags bucket.\n\t\tm.addFileLocked(dev, 0, f)\n\t} else {\n\t\t// Account in flag specific buckets.\n\t\teachFlagBit(flags, func(flag ... |
{
"audio": "",
"image": "",
"text": "func FilterEmpty(stringSlice []string) []string {\n\tvar result []string\n\tfor",
"video": ""
} | {
"audio": "",
"image": "",
"text": " _, str := range stringSlice {\n\t\tif str != \"\" {\n\t\t\tresult = append(result, str)\n\t\t}\n\t}\n\treturn result\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tvar out []string\n\tfor _, relocate := range relocators {\n\t\tout = append(out, diskRelocateString(relocate))\n\t}\n\treturn strings.Join(out, \",\")\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func FetchSysAttrs() error {\n\toutput, err := ioutil.ReadFile(\"/etc/os-release\")\n\tif err != nil {\n\t\tlog.Errorf(\"Error reading the /etc/os-release Error: %s Output: \\n%s\\n\", err, output)\n\t\treturn err\n\t}\n\n\tstrOutput := string(output)\n\tif strings.Contains(st... | {
"audio": "",
"image": "",
"text": " if strings.Contains(strOutput, \"Ubuntu\") {\n\t\tSysAttrs.OsType = \"ubuntu\"\n\t} else {\n\t\tSysAttrs.OsType = \"unsupported\"\n\t}\n\n\t// fetch the system memory, disk, and other attributes\n\treturn err\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " bytes.\n\toutput := new(bytes.Buffer)\n\toutput.Write(b[:firstEsc])\n\n\tfor _, c := range b[firstEsc:] {\n\t\tif isSafeChar(c) {\n\t\t\toutput.WriteByte(c)\n\t\t} else {\n\t\t\tfmt.Fprintf(output, \"%%%02X\", c)\n\t\t}\n\t}\n\treturn output.String()\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func NewNodeProxy() (*NodeSvcProxy, error) {\n\tipTablesPath, err := osexec.LookPath(\"iptables\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Install contiv chain and jump\n\tout, err := osexec.Command(ipTablesPath, \"-w\", iptablesWaitLock,\n\t\t\"-t\", \"nat\", \"-... | {
"audio": "",
"image": "",
"text": "\n\n\t// Flush any old rules we might have added. They will get re-added\n\t// if the service is still active\n\tosexec.Command(ipTablesPath, \"-w\", iptablesWaitLock, \"-t\", \"nat\", \"-F\",\n\t\tcontivNPChain).CombinedOutput()\n\n\tproxy := NodeSvcProxy{}\n\tproxy.SvcMap = ... | {
"audio": "",
"image": "",
"text": " envPath)\n\n\tout, err := exec.Command(\"bash\", \"-c\", cmd).Output()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"Failed to execute command: %s\", cmd)\n\t}\n\treturn string(out), nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (p *NodeSvcProxy) DeleteLocalIP(globalIP string) {\n\t// strip cidr\n\tglobalIP = strings.Split(globalIP, \"/\")[0]\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tp.Mutex.Lock()\n\tdefer p.Mutex.Unlock()\n\tdelete(p.LocalIP, globalIP)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\t\ttyp = typ.Elem()\n\t}\n\tnameWithPackage := typ.String()\n\t// Strip the package name\n\treturn strings.Join(strings.Split(nameWithPackage, \".\")[1:], \"\")\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (p *NodeSvcProxy) AddLocalIP(globalIP, localIP string) {\n\t// strip cidr\n\tglobalIP = strings.Split(globalIP,",
"video": ""
} | {
"audio": "",
"image": "",
"text": " \"/\")[0]\n\tlocalIP = strings.Split(localIP, \"/\")[0]\n\tp.Mutex.Lock()\n\tdefer p.Mutex.Unlock()\n\tp.LocalIP[globalIP] = localIP\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\treturn p.NetworkDriver.CreateHostAccPort(portName, globalIP, p.PluginConfig.Instance.HostPvtNW)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (p *NodeSvcProxy) AddSvcSpec(svcName string, spec *core.ServiceSpec) error {\n\tp.Mutex.Lock()\n\tdefer p.Mutex.Unlock()\n\tlog.Infof(\"Node proxy AddSvcSpec: %s\", svcName)\n\t// Determine if this is a node service\n\tisNodeSvc := false\n\tfor _, port := range spec.Ports... | {
"audio": "",
"image": "",
"text": "\t\treturn nil\n\t\t\t}\n\t\t}\n\t}\n\n\tif !isNodeSvc {\n\t\tp.deleteSvc(svcName) // delete it if it exists\n\t\treturn nil\n\t}\n\n\tp.SvcMap[svcName] = *spec\n\tp.syncSvc(svcName)\n\treturn nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " the ports and generate a named listener for\n\t\t// each port.\n\t\tfor _, port := range svc.Ports {\n\t\t\t// Only listen on ServicePorts\n\t\t\tif port.ServicePort < 1 {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tlisteners = append(listeners, s.EnvoyListenerFromService(svc, port.S... |
{
"audio": "",
"image": "",
"text": "func (p *NodeSvcProxy) DelSvcSpec(svcName string, spec *core.ServiceSpec)",
"video": ""
} | {
"audio": "",
"image": "",
"text": " error {\n\tp.Mutex.Lock()\n\tdefer p.Mutex.Unlock()\n\tp.deleteSvc(svcName) // delete it if it exists\n\treturn nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " string, _ string) (string, error) {\n\treturn \"\", nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func readLoginCredentials(ctx *cli.Context) (string, string) {\n\tfmt.Print(\"Username: \")\n\n\treader := bufio.NewReader(os.Stdin)\n\tusername, err := reader.ReadString('\\n')\n\tif err != nil {\n\t\terrExit(ctx, exitIO, err.Error(), false)\n\t}\n\n\tusername = strings.TrimS... | {
"audio": "",
"image": "",
"text": " typed\n\tbytePassword, err := terminal.ReadPassword(0) // fd 0 = stdin\n\tif err != nil {\n\t\terrExit(ctx, exitIO, err.Error(), false)\n\t}\n\tpassword := string(bytePassword)\n\tfmt.Println(\"\")\n\n\treturn username, password\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\terrExit(ctx, exitIO, err.Error(), false)\n\t}\n\n\t// only the user should be able to read the config file\n\tif err := ioutil.WriteFile(configPath(), data, 0600); err != nil {\n\t\terrExit(ctx, exitIO, err.Error(), false)\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func addBgp(ctx *cli.Context) {\n\tif len(ctx.Args()) < 1 {\n\t\terrExit(ctx, exitHelp, \"Host name required\", true)\n\t}\n\n\thostname := ctx.Args()[0]\n\trouterip := ctx.String(\"router-ip\")\n\tasid := ctx.String(\"as\")\n\tneighboras := ctx.String(\"neighbor-as\")\n\tneig... | {
"audio": "",
"image": "",
"text": " format\", true)\n\t}\n\n\tif routerip == \"\" || asid == \"\" || neighbor == \"\" || neighboras == \"\" {\n\t\terrExit(ctx, exitHelp, \"Missing attributes\", true)\n\t}\n\n\terrCheck(ctx, getClient(ctx).BgpPost(&contivClient.Bgp{\n\t\tAs: asid,\n\t\tHostname: hostna... | {
"audio": "",
"image": "",
"text": " len(x.Children))\n\n\tfor i := range x.Children {\n\t\tret[i] = x.Children[i]\n\t}\n\n\treturn ret\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func deleteBgp(ctx *cli.Context) {\n\tif len(ctx.Args()) != 1 {\n\t\terrExit(ctx, exitHelp, \"Host name required\", true)\n\t}\n\n\thostname := ctx.Args()[0]\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tfmt.Printf(\"Deleting Bgp router config: %s\\n\", hostname)\n\n\terrCheck(ctx, getClient(ctx).BgpDelete(hostname))\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " *Context {\n\tfmt.Fprintf(ctx.Writer(), format, args...)\n\treturn ctx\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func listBgp(ctx *cli.Context) {\n\tif len(ctx.Args()) != 0 {\n\t\terrExit(ctx, exitHelp, \"More arguments than required\", true)\n\t}\n\n\tbgpList, err := getClient(ctx).BgpList()\n\terrCheck(ctx, err)\n\n\tif ctx.Bool(\"json\") {\n\t\tdumpJSONList(ctx, bgpList)\n\t} else if ... | {
"audio": "",
"image": "",
"text": "\n\t\t}\n\t\tos.Stdout.WriteString(bgpName)\n\t} else {\n\t\twriter := tabwriter.NewWriter(os.Stdout, 0, 2, 2, ' ', 0)\n\t\tdefer writer.Flush()\n\t\twriter.Write([]byte(\"HostName\\tRouterIP\\tAS\\tNeighbor\\tNeighborAS\\n\"))\n\t\twriter.Write([]byte(\"---------\\t--------\\... | {
"audio": "",
"image": "",
"text": " func(ctx context.Context) error {\n\t\treturn UpdateTenant(ctx, config)\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func createServiceLB(ctx *cli.Context) {\n\tif len(ctx.Args()) != 1 {\n\t\terrExit(ctx, exitHelp, \"Service name required\", true)\n\t}\n\n\tserviceName := ctx.Args()[0]\n\tserviceSubnet := ctx.String(\"network\")\n\ttenantName := ctx.String(\"tenant\")\n\tif len(tenantName) =... | {
"audio": "",
"image": "",
"text": " := ctx.StringSlice(\"port\")\n\tipAddress := ctx.String(\"preferred-ip\")\n\tservice := &contivClient.ServiceLB{\n\t\tServiceName: serviceName,\n\t\tTenantName: tenantName,\n\t\tNetworkName: serviceSubnet,\n\t\tIpAddress: ipAddress,\n\t}\n\tservice.Selectors = append(servi... | {
"audio": "",
"image": "",
"text": " *Context {\n\tfmt.Fprintf(ctx.Writer(), format, args...)\n\treturn ctx\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func deleteServiceLB(ctx *cli.Context) {\n\tif len(ctx.Args()) != 1 {\n\t\terrExit(ctx, exitHelp, \"Service name required\", true)\n\t}\n\n\tserviceName := ctx.Args()[0]\n\ttenantName := ctx.String(\"tenant\")\n\tif len(tenantName) == 0 {\n\t\ttenantName = \"default\"\n\t}\n",... | {
"audio": "",
"image": "",
"text": "\tfmt.Printf(\"Deleting Service %s,%s\\n\", serviceName, tenantName)\n\n\terrCheck(ctx, getClient(ctx).ServiceLBDelete(tenantName, serviceName))\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " *Context {\n\tfmt.Fprintf(ctx.Writer(), format, args...)\n\treturn ctx\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func listServiceLB(ctx *cli.Context) {\n\n\ttenantName := ctx.String(\"tenant\")\n\tif len(tenantName) == 0 {\n\t\ttenantName = \"default\"\n\t}\n\t_, err := getClient(ctx).TenantGet(tenantName)\n\terrCheck(ctx, err)\n\n\tsvcList, err := getClient(ctx).ServiceLBList()\n\terrCh... | {
"audio": "",
"image": "",
"text": "\t}\n\t\t}\n\t}\n\n\tif ctx.Bool(\"json\") {\n\t\tdumpJSONList(ctx, filtered)\n\t} else if ctx.Bool(\"quiet\") {\n\t\tservices := \"\"\n\t\tfor _, service := range filtered {\n\t\t\tservices += service.ServiceName + \"\\n\"\n\t\t}\n\t\tos.Stdout.WriteString(services)\n\t} else... | {
"audio": "",
"image": "",
"text": "\n\t\tif structs.SatisfiesMetaFilters(node.Node.Meta, filters) {\n\t\t\tfiltered = append(filtered, node)\n\t\t}\n\t}\n\treturn filtered\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (cp *ConsulClient) GetService(srvName string) ([]ServiceInfo, error) {\n\tkeyName := \"contiv.io/service/\" + srvName + \"/\"\n\tsrvList, _,",
"video": ""
} | {
"audio": "",
"image": "",
"text": " err := cp.getServiceInstances(keyName, 0)\n\n\treturn srvList, err\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\t\t\taclPolicyRefs[key] = \"/\" + ChannelGroupKey + \"/\" + ApplicationGroupKey + \"/\" + acl.PolicyRef\n\t\t} else {\n\t\t\taclPolicyRefs[key] = acl.PolicyRef\n\t\t}\n\t}\n\n\treturn &aclsProvider{\n\t\taclPolicyRefs: aclPolicyRefs,\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (cp *ConsulClient) WatchService(srvName string, eventCh chan WatchServiceEvent, stopCh chan bool) error {\n\tkeyName := \"contiv.io/service/\" + srvName + \"/\"\n\n\t// Run in background\n\tgo func() {\n\t\tvar currSrvMap = make(map[string]ServiceInfo)\n\n\t\t// Get curre... | {
"audio": "",
"image": "",
"text": " strconv.Itoa(srvInfo.Port)\n\n\t\t\t\t\t\t// If the entry didnt exists previously, trigger add event\n\t\t\t\t\t\tif _, ok := currSrvMap[srvKey]; !ok {\n\t\t\t\t\t\t\tlog.Debugf(\"Sending add event for srv: %v\", srvInfo)\n\t\t\t\t\t\t\teventCh <- WatchServiceEvent{\n\t\t\t\t... | {
"audio": "",
"image": "",
"text": " parse tag filter '%s' for event '%s': %v\",\n\t\t\t\t\tmsg.TagFilter, msg.Name, err)\n\t\t\t\treturn false\n\t\t\t}\n\t\t\ttagRe = re\n\t\t}\n\n\t\t// Scan for a match\n\t\tservices := a.State.Services()\n\t\tfound := false\n\tOUTER:\n\t\tfor name, info := range services {\n\... |
{
"audio": "",
"image": "",
"text": "func (cp *ConsulClient) DeregisterService(serviceInfo ServiceInfo) error {\n\tkeyName := \"contiv.io/service/\" + serviceInfo.ServiceName + \"/\" +\n\t\tserviceInfo.HostAddr + \":\" + strconv.Itoa(serviceInfo.Port)\n\n\t// Find it in the database\n\tsrvState := cp.serviceDb[ke... | {
"audio": "",
"image": "",
"text": "\n\tclose(srvState.stopChan)\n\tdelete(cp.serviceDb, keyName)\n\n\t// Delete the service instance\n\t_, err := cp.client.KV().Delete(keyName, nil)\n\tif err != nil {\n\t\tlog.Errorf(\"Error deleting key %s. Err: %v\", keyName, err)\n\t\treturn err\n\t}\n\n\treturn nil\n}",
"... | {
"audio": "",
"image": "",
"text": " + strconv.Itoa(internalPort) + \"</NewInternalPort>\" +\n\t\t\"<NewInternalClient>\" + n.ourIP + \"</NewInternalClient>\" +\n\t\t\"<NewEnabled>1</NewEnabled><NewPortMappingDescription>\"\n\tmessage += description +\n\t\t\"</NewPortMappingDescription><NewLeaseDuration>\" + str... |
{
"audio": "",
"image": "",
"text": "func (cp *ConsulClient) getServiceInstances(key string, waitIdx uint64) ([]ServiceInfo, uint64, error) {\n\tvar srvcList []ServiceInfo\n\n\t// Get the object from consul client\n\tkvs, meta, err := cp.client.KV().List(key, &api.QueryOptions{WaitIndex: waitIdx})\n\tif err != ni... | {
"audio": "",
"image": "",
"text": "\n\t}\n\n\t// Parse each node in the directory\n\tfor _, kv := range kvs {\n\t\tvar respSrvc ServiceInfo\n\t\t// Parse JSON response\n\t\terr = json.Unmarshal([]byte(kv.Value), &respSrvc)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error parsing object %+v, Err %v\", kv, err)\n\t... | {
"audio": "",
"image": "",
"text": "\t\t// Generate a master key of 256 bytes\n\t\t_, err := rand.Read(key)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\t// Use the provided key\n\t\tkey = *masterKey\n\t}\n\n\terr := ctxutil.ErrIfDone(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tt... |
{
"audio": "",
"image": "",
"text": "func DeleteEndpointGroup(tenantName, groupName string) error {\n\t// Get the state driver\n\tstateDriver, err := utils.GetStateDriver()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tepgKey := mastercfg.GetEndpointGroupKey(groupName, tenantName)\n\tepgCfg := &mastercfg.EndpointG... | {
"audio": "",
"image": "",
"text": "\n\t\treturn aErr\n\t}\n\n\tif aciMode {\n\t\tif epgCfg.PktTagType == \"vlan\" {\n\t\t\terr = gCfg.FreeVLAN(uint(epgCfg.PktTag))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tlog.Debugf(\"Freed vlan %v\\n\", epgCfg.PktTag)\n\t\t}\n\t}\n\n\t// mark it as unused\n\t... | {
"audio": "",
"image": "",
"text": "\tstateDriver, err := utils.GetStateDriver()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// find the network from network id\n\tnetID := epReq.NetworkName + \".\" + epReq.TenantName\n\tnwCfg := &mastercfg.CfgNetworkState{}\n\tnwCfg.StateDriver = stateDriver\n\terr = nwCf... |
{
"audio": "",
"image": "",
"text": "func UpdateEndpointGroup(bandwidth, groupName, tenantName string, Dscp, burst int) error {\n\n\t// Get the state driver - get the etcd driver state\n\tstateDriver, err := utils.GetStateDriver()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tkey := mastercfg.GetEndpointGroupKey(g... | {
"audio": "",
"image": "",
"text": " != nil {\n\t\tlog.Errorf(\"Error finding endpointgroup %s. Err: %v\", key, err)\n\t\treturn err\n\t}\n\n\t//update the epGroup state\n\tepCfg.DSCP = Dscp\n\tepCfg.Bandwidth = bandwidth\n\tepCfg.Burst = burst\n\n\t//Write to etcd\n\treturn epCfg.Write()\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tstateDriver, err := utils.GetStateDriver()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// find the network from network id\n\tnetID := epReq.NetworkName + \".\" + epReq.TenantName\n\tnwCfg := &mastercfg.CfgNetworkState{}\n\tnwCfg.StateDriver = stateDriver\n\terr = nwCf... |
{
"audio": "",
"image": "",
"text": "func SvcProviderUpdate(serviceID string, isDelete bool) error {\n\tproviderList := []string{}\n\n\tstateDriver, err := utils.GetStateDriver()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsvcProvider := &mastercfg.SvcProvider{}\n\tsvcProvider.StateDriver = stateDriver\n\n\tif _... | {
"audio": "",
"image": "",
"text": " provider list\n\tsvcProvider.Providers = append(svcProvider.Providers, providerList...)\n\tsvcProvider.ServiceName = serviceID\n\tsvcProvider.ID = serviceID\n\n\tlog.Infof(\"Updating service providers with {%v} on service %s\", svcProvider.Providers, serviceID)\n\n\treturn sv... | {
"audio": "",
"image": "",
"text": "\tstateDriver, err := utils.GetStateDriver()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// find the network from network id\n\tnetID := epReq.NetworkName + \".\" + epReq.TenantName\n\tnwCfg := &mastercfg.CfgNetworkState{}\n\tnwCfg.StateDriver = stateDriver\n\terr = nwCf... |
{
"audio": "",
"image": "",
"text": "func ErrIfKeyExists(err error) error {\n\tif err == nil ||",
"video": ""
} | {
"audio": "",
"image": "",
"text": " strings.Contains(err.Error(), \"key not found\") {\n\t\treturn nil\n\t}\n\n\treturn err\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " to %s\", name)\n\t\t}\n\t\t*conn = c\n\t\treturn nil\n\t}\n\n\tg.Go(func() error {\n\t\treturn dialfn(stdin, &set.stdin)\n\t})\n\tg.Go(func() error {\n\t\treturn dialfn(stdout, &set.stdout)\n\t})\n\tg.Go(func() error {\n\t\treturn dialfn(stderr, &set.stderr)\n\t})\n\n\terr = ... |
{
"audio": "",
"image": "",
"text": "func (r *AutoVLANCfgResource) ReadAll() ([]core.State, error)",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\treturn r.StateDriver.ReadAllState(vLANResourceConfigPathPrefix, r,\n\t\tjson.Unmarshal)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\treturn \"\"\n\t}\n\treturn r.Error.Error()\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (r *AutoVLANCfgResource) Allocate(reqVal interface{}) (interface{}, error) {\n\toper := &AutoVLANOperResource{}\n\toper.StateDriver = r.StateDriver\n\terr := oper.Read(r.ID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar vlan uint\n\tif (reqVal != nil) && (reqVal.(... | {
"audio": "",
"image": "",
"text": " false\n\t\tvlan, ok = oper.FreeVLANs.NextSet(0)\n\t\tif !ok {\n\t\t\treturn nil, errors.New(\"no vlans available\")\n\t\t}\n\t}\n\toper.FreeVLANs.Clear(vlan)\n\n\terr = oper.Write()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn vlan, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\terr = r.Session.DoRequest(\"SoftLayer_Network_Vlan_Firewall\", \"restoreDefaults\", nil, &r.Options, &resp)\n\treturn\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (r *AutoVLANCfgResource) Deallocate(value interface{}) error {\n\toper := &AutoVLANOperResource{}\n\toper.StateDriver = r.StateDriver\n\terr := oper.Read(r.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvlan, ok := value.(uint)",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tif !ok {\n\t\treturn core.Errorf(\"Invalid type for vlan value\")\n\t}\n\tif oper.FreeVLANs.Test(vlan) {\n\t\treturn nil\n\t}\n\toper.FreeVLANs.Set(vlan)\n\n\treturn oper.Write()\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " *resources.AutoVXLANCfgResource\n\t\tvxlanRsrcCfg, err = gc.initVXLANBitset(gc.Auto.VXLANs)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = ra.RedefineResource(\"global\", resources.AutoVXLANResource, vxlanRsrcCfg)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error delet... |
{
"audio": "",
"image": "",
"text": "func (r *AutoVLANOperResource) ReadAll() ([]core.State, error)",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\treturn r.StateDriver.ReadAllState(vLANResourceOperPathPrefix, r,\n\t\tjson.Unmarshal)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\treturn \"\"\n\t}\n\treturn r.Error.Error()\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (d *OvsDriver) DeleteHostAccPort(id string) error {\n\tsw, found := d.switchDb[\"host\"]\n\tif found {\n\t\toperEp := &drivers.OperEndpointState{}\n\t\toperEp.StateDriver = d.oper.StateDriver\n\t\terr := operEp.Read(id)\n\t\tif err != nil {\n\t\t\treturn err\n",
"video"... | {
"audio": "",
"image": "",
"text": "\t\t}\n\t\td.HostProxy.DeleteLocalIP(operEp.IPAddress)\n\t\tportName := operEp.PortName\n\t\tintfName := netutils.GetHostIntfName(portName)\n\t\treturn sw.DelHostPort(intfName, false)\n\t}\n\n\treturn errors.New(\"host bridge not found\")\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\td := t.newScyllaTable(tinfo, dat)\n\tif d != nil {\n\t\t//err := d.read(ScyllaWhere{Clauses: tinfo.Clauses}, data)\n\t\terr = d.readMulti(tinfo.PksClauses, limit, data)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (d *OvsDriver) CreateHostAccPort(portName, globalIP string, net int) (string, error) {\n\tsw, found := d.switchDb[\"host\"]\n\tif found {\n\t\tnum := strings.Replace(portName, \"hport\", \"\", 1)\n\t",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tintfNum, err := strconv.Atoi(num)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\thostIP, err := sw.AddHostPort(portName, intfNum, net, false)\n\t\tif err == nil {\n\t\t\td.HostProxy.AddLocalIP(globalIP, hostIP)\n\t\t\treturn hostIP, nil\n\t\t}\n\t}\n\n\treturn \"... | {
"audio": "",
"image": "",
"text": "\n\treturn p.NetworkDriver.CreateHostAccPort(portName, globalIP, p.PluginConfig.Instance.HostPvtNW)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (d *OvsDriver) Deinit() {\n\tlog.Infof(\"Cleaning up ovsdriver\")\n\n\t// cleanup both vlan and vxlan OVS instances\n\tif d.switchDb[\"vlan\"] != nil {\n\t\td.switchDb[\"vlan\"].RemoveUplinks()\n\t\td.switchDb[\"vlan\"].Delete()",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t}\n\tif d.switchDb[\"vxlan\"] != nil {\n\t\td.switchDb[\"vxlan\"].DelHostPort(hostPortName, true)\n\t\td.switchDb[\"vxlan\"].Delete()\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " stream.\n\t\t\td.chunked = true\n\t\t} else {\n\t\t\t// via https://tools.ietf.org/html/rfc7230#section-3.3.2\n\t\t\td.req.ContentLength = 0\n\t\t}\n\t}\n\n\t// check \"Connection\" for \"Keep-Alive\"\n\td.kalive = d.req.Header.Get(\"Connection\") == \"Keep-Alive\"\n\n\tlog.V... |
{
"audio": "",
"image": "",
"text": "func (d *OvsDriver) CreateNetwork(id string) error {\n\tcfgNw := mastercfg.CfgNetworkState{}\n\tcfgNw.StateDriver = d.oper.StateDriver\n\terr := cfgNw.Read(id)\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to read net %s \\n\", cfgNw.ID)\n\t\treturn err\n\t}\n\tlog.Infof(\"creat... | {
"audio": "",
"image": "",
"text": " d.switchDb[\"vxlan\"]\n\t} else {\n\t\tsw = d.switchDb[\"vlan\"]\n\t}\n\n\treturn sw.CreateNetwork(uint16(cfgNw.PktTag), uint32(cfgNw.ExtPktTag), cfgNw.Gateway, cfgNw.Tenant)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tstateDriver, err := utils.GetStateDriver()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// find the network from network id\n\tnetID := epReq.NetworkName + \".\" + epReq.TenantName\n\tnwCfg := &mastercfg.CfgNetworkState{}\n\tnwCfg.StateDriver = stateDriver\n\terr = nwCf... |
{
"audio": "",
"image": "",
"text": "func (d *OvsDriver) DeleteNetwork(id, subnet, nwType, encap string, pktTag, extPktTag int, gateway string, tenant string) error {\n\tlog.Infof(\"delete net %s, nwType %s, encap %s, tags: %d/%d\", id, nwType, encap, pktTag, extPktTag)\n\n\t// Find the switch based on network ty... | {
"audio": "",
"image": "",
"text": " + hostName\n\n\t\tepOper := drivers.OperEndpointState{}\n\t\tepOper.StateDriver = d.oper.StateDriver\n\t\terr := epOper.Read(epID)\n\t\tif err == nil {\n\t\t\terr = sw.DeletePort(&epOper, true)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"Error deleting endpoint: %+v. Err: %v... | {
"audio": "",
"image": "",
"text": "\n\t\t\tsw.metrics.Peers.Add(float64(-1))\n\t\t}\n\t}\n\n\t// Stop reactors\n\tsw.Logger.Debug(\"Switch: Stopping reactors\")\n\tfor _, reactor := range sw.reactors {\n\t\treactor.Stop()\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (d *OvsDriver) UpdateEndpointGroup(id string) error {\n\tlog.Infof(\"Received endpoint group update for %s\", id)\n\tvar (\n\t\terr error\n\t\tepgBandwidth int64\n\t\tsw *OvsSwitch\n\t)\n\t//gets the EndpointGroupState object\n\tcfgEpGroup := &mastercfg... | {
"audio": "",
"image": "",
"text": " %s \", cfgEpGroup.Bandwidth, epInfo.Ovsportname)\n\t\t\t\t// Find the switch based on network type\n\t\t\t\tif epInfo.BridgeType == \"vxlan\" {\n\t\t\t\t\tsw = d.switchDb[\"vxlan\"]\n\t\t\t\t} else {\n\t\t\t\t\tsw = d.switchDb[\"vlan\"]\n\t\t\t\t}\n\n\t\t\t\t// update the end... | {
"audio": "",
"image": "",
"text": " *resources.AutoVXLANCfgResource\n\t\tvxlanRsrcCfg, err = gc.initVXLANBitset(gc.Auto.VXLANs)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = ra.RedefineResource(\"global\", resources.AutoVXLANResource, vxlanRsrcCfg)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error delet... |
{
"audio": "",
"image": "",
"text": "func (d *OvsDriver) DeleteEndpoint(id string) error {\n\tepOper := drivers.OperEndpointState{}\n\tepOper.StateDriver = d.oper.StateDriver\n\terr := epOper.Read(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tepOper.Clear()\n\t}()\n\n\t// Get the network stat... | {
"audio": "",
"image": "",
"text": " d.switchDb[\"vxlan\"]\n\t} else {\n\t\tsw = d.switchDb[\"vlan\"]\n\t}\n\n\tskipVethPair := (cfgNw.NwType == \"infra\")\n\terr = sw.DeletePort(&epOper, skipVethPair)\n\tif err != nil {\n\t\tlog.Errorf(\"Error deleting endpoint: %+v. Err: %v\", epOper, err)\n\t}\n\n\td.oper.loc... | {
"audio": "",
"image": "",
"text": "\tstateDriver, err := utils.GetStateDriver()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// find the network from network id\n\tnetID := epReq.NetworkName + \".\" + epReq.TenantName\n\tnwCfg := &mastercfg.CfgNetworkState{}\n\tnwCfg.StateDriver = stateDriver\n\terr = nwCf... |
{
"audio": "",
"image": "",
"text": "func (d *OvsDriver) AddPeerHost(node core.ServiceInfo) error {\n\t// Nothing to do if this is our own IP\n\tif node.HostAddr == d.localIP {\n\t\treturn nil\n\t}\n\n\tlog.Infof(\"CreatePeerHost for %+v\", node)\n\n\t// Add the VTEP for the peer in vxlan switch.\n\terr :=",
"v... | {
"audio": "",
"image": "",
"text": " d.switchDb[\"vxlan\"].CreateVtep(node.HostAddr)\n\tif err != nil {\n\t\tlog.Errorf(\"Error adding the VTEP %s. Err: %s\", node.HostAddr, err)\n\t\treturn err\n\t}\n\n\treturn nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tcontinue\n\t\t}\n\t\tlogrus.Infof(\"gossip: pinging peer node (%v: %v) for suspect %v\", fdNodeId, nodeInfo.Addr, nodeId)\n\t\t_, pingErr := gd.ping(fdNodeId, nodeInfo.Addr)\n\t\tif pingErr != nil {\n\t\t\t// Ping to a node in the same cluster domain as the suspected node\... |
{
"audio": "",
"image": "",
"text": "func (d *OvsDriver) DeletePeerHost(node core.ServiceInfo) error {\n\t// Nothing to do if this is our own IP\n\tif node.HostAddr == d.localIP {\n\t\treturn nil\n\t}\n\n\tlog.Infof(\"DeletePeerHost for %+v\", node)\n\n\t// Remove the VTEP for the peer in vxlan switch.\n\terr :="... | {
"audio": "",
"image": "",
"text": " d.switchDb[\"vxlan\"].DeleteVtep(node.HostAddr)\n\tif err != nil {\n\t\tlog.Errorf(\"Error deleting the VTEP %s. Err: %s\", node.HostAddr, err)\n\t\treturn err\n\t}\n\n\treturn nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tcontinue\n\t\t}\n\t\tlogrus.Infof(\"gossip: pinging peer node (%v: %v) for suspect %v\", fdNodeId, nodeInfo.Addr, nodeId)\n\t\t_, pingErr := gd.ping(fdNodeId, nodeInfo.Addr)\n\t\tif pingErr != nil {\n\t\t\t// Ping to a node in the same cluster domain as the suspected node\... |
{
"audio": "",
"image": "",
"text": "func (d *OvsDriver) AddBgp(id string) error {\n\tvar sw *OvsSwitch\n\n\tcfg := mastercfg.CfgBgpState{}\n\tcfg.StateDriver = d.oper.StateDriver\n\terr := cfg.Read(id)\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to read router state %s \\n\", cfg.Hostname)\n\t\treturn err\n\t}\n... | {
"audio": "",
"image": "",
"text": "\n\n\t// Find the switch based on network type\n\tsw = d.switchDb[\"vlan\"]\n\n\treturn sw.AddBgp(cfg.Hostname, cfg.RouterIP, cfg.As, cfg.NeighborAs, cfg.Neighbor)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " type %s\", cfg.StorageType)\n\t}\n\n\tJim.Configure(func(message string, args ...interface{}) {\n\t\tlog.Printf(message, args...)\n\t})\n\tif cfg.InviteJim {\n\t\tcfg.Monkey = Jim\n\t}\n\n\tif len(cfg.OutgoingSMTPFile) > 0 {\n\t\tb, err := ioutil.ReadFile(cfg.OutgoingSMTPFile... |
{
"audio": "",
"image": "",
"text": "func (d *OvsDriver) DeleteBgp(id string) error {\n\tlog.Infof(\"Delete Bgp Neighbor %s \\n\", id)\n\t//FixME: We are not maintaining",
"video": ""
} | {
"audio": "",
"image": "",
"text": " oper state for Bgp\n\t//Need to Revisit again\n\t// Find the switch based on network type\n\tvar sw *OvsSwitch\n\tsw = d.switchDb[\"vlan\"]\n\treturn sw.DeleteBgp()\n\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " Add the Bgp neighbor\n\terr = master.AddBgp(stateDriver, &bgpIntentCfg)\n\tif err != nil {\n\t\tlog.Errorf(\"Error creating Bgp neighbor {%+v}. Err: %v\", NewbgpCfg.Neighbor, err)\n\t\treturn err\n\t}\n\n\toldbgpCfg.Hostname = NewbgpCfg.Hostname\n\toldbgpCfg.Routerip = Newbgp... |
{
"audio": "",
"image": "",
"text": "func convSvcSpec(spec *core.ServiceSpec) *ofnet.ServiceSpec {\n\tpSpec := make([]ofnet.PortSpec, len(spec.Ports))\n\tfor ix, p := range spec.Ports {",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\tpSpec[ix].Protocol = p.Protocol\n\t\tpSpec[ix].SvcPort = p.SvcPort\n\t\tpSpec[ix].ProvPort = p.ProvPort\n\t}\n\n\tofnetSS := ofnet.ServiceSpec{\n\t\tIpAddress: spec.IPAddress,\n\t\tPorts: pSpec,\n\t}\n\treturn &ofnetSS\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " i := range b.Spec.Steps {\n\t\tif b.Spec.Steps[i].WorkingDir != \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tb.Spec.Steps[i].WorkingDir = wd.Value\n\t}\n\tif b.Spec.Template != nil {\n\t\t// Best we can do for a template is to set WORKDIR\n\t\tb.Spec.Template.Arguments = append(b.Spec.... |
{
"audio": "",
"image": "",
"text": "func (d *OvsDriver) AddSvcSpec(svcName string, spec *core.ServiceSpec) error {\n\tlog.Infof(\"AddSvcSpec: %s\", svcName)\n\tss := convSvcSpec(spec)\n\terrs := \"\"\n\tfor _, sw := range d.switchDb {\n\t\tlog.Infof(\"sw AddSvcSpec: %s\", svcName)\n\t\terr := sw.AddSvcSpec(svcNa... | {
"audio": "",
"image": "",
"text": " {\n\t\terrs += err.Error()\n\t}\n\n\tif errs != \"\" {\n\t\treturn errors.New(errs)\n\t}\n\n\td.nameServer.AddLbService(nameserver.K8sDefaultTenant, svcName, spec.IPAddress)\n\n\treturn nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " what we\n\t\t// shouldn't be\n\t\tfor _, d := range deployments {\n\t\t\tif d.Active() {\n\t\t\t\tif err := w.add(d); err != nil {\n\t\t\t\t\tw.logger.Error(\"failed to track deployment\", \"deployment_id\", d.ID, \"error\", err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tw.remove(d... |
{
"audio": "",
"image": "",
"text": "func (d *OvsDriver) DelSvcSpec(svcName string, spec *core.ServiceSpec) error {\n\tss := convSvcSpec(spec)\n\terrs := \"\"\n\tfor _, sw := range d.switchDb {\n\t\terr := sw.DelSvcSpec(svcName, ss)\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tif err != nil {\n\t\t\terrs += err.Error()\n\t\t}\n\t}\n\n\terr := d.HostProxy.DelSvcSpec(svcName, spec)\n\tif err != nil {\n\t\terrs += err.Error()\n\t}\n\n\tif errs != \"\" {\n\t\treturn errors.New(errs)\n\t}\n\n\td.nameServer.DelLbService(nameserver.K8sDefaultTenant, sv... | {
"audio": "",
"image": "",
"text": "\n\t\t\tsw.metrics.Peers.Add(float64(-1))\n\t\t}\n\t}\n\n\t// Stop reactors\n\tsw.Logger.Debug(\"Switch: Stopping reactors\")\n\tfor _, reactor := range sw.reactors {\n\t\treactor.Stop()\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (d *OvsDriver) GetEndpointStats() ([]byte, error) {\n\tvxlanStats, err := d.switchDb[\"vxlan\"].GetEndpointStats()\n\tif err != nil {\n\t\tlog.Errorf(\"Error getting vxlan stats. Err: %v\", err)\n\t\treturn []byte{}, err\n\t}\n\n\tvlanStats, err := d.switchDb[\"vlan\"].Ge... | {
"audio": "",
"image": "",
"text": "\n\t\tvlanStats[key] = val\n\t}\n\n\tjsonStats, err := json.Marshal(vlanStats)\n\tif err != nil {\n\t\tlog.Errorf(\"Error encoding epstats. Err: %v\", err)\n\t\treturn jsonStats, err\n\t}\n\n\treturn jsonStats, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " *resources.AutoVXLANCfgResource\n\t\tvxlanRsrcCfg, err = gc.initVXLANBitset(gc.Auto.VXLANs)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = ra.RedefineResource(\"global\", resources.AutoVXLANResource, vxlanRsrcCfg)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error delet... |
{
"audio": "",
"image": "",
"text": "func (d *OvsDriver) InspectState() ([]byte, error) {\n\tdriverState := make(map[string]interface{})\n\n\t// get vlan switch state\n\tvlanState, err := d.switchDb[\"vlan\"].InspectState()\n\tif err != nil {\n\t\treturn []byte{}, err\n\t}\n\n\t// get vxlan switch state\n\tvxlanS... | {
"audio": "",
"image": "",
"text": " d.switchDb[\"vxlan\"].InspectState()\n\tif err != nil {\n\t\treturn []byte{}, err\n\t}\n\n\t// build the map\n\tdriverState[\"vlan\"] = vlanState\n\tdriverState[\"vxlan\"] = vxlanState\n\n\t// json marshall the map\n\tjsonState, err := json.Marshal(driverState)\n\tif err != n... | {
"audio": "",
"image": "",
"text": "\n\tdi := diskInfo{&hi.ChangeVersion, hi.Kind == hooks.RelationJoined}\n\tif err := utils.WriteYaml(path, &di); err != nil {\n\t\treturn err\n\t}\n\t// If write was successful, update own state.\n\td.state.Members[hi.RemoteUnit] = hi.ChangeVersion\n\tif hi.Kind == hooks.Relati... |
{
"audio": "",
"image": "",
"text": "func (d *OvsDriver) InspectBgp() ([]byte, error) {\n\n\t// get vlan switch state\n\tbgpState, err := d.switchDb[\"vlan\"].InspectBgp()\n\tif err != nil {\n\t\treturn []byte{}, err\n\t}\n\n\t// json marshall the map\n\tjsonState, err :=",
"video": ""
} | {
"audio": "",
"image": "",
"text": " json.Marshal(bgpState)\n\tif err != nil {\n\t\tlog.Errorf(\"Error encoding epstats. Err: %v\", err)\n\t\treturn []byte{}, err\n\t}\n\n\treturn jsonState, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tdi := diskInfo{&hi.ChangeVersion, hi.Kind == hooks.RelationJoined}\n\tif err := utils.WriteYaml(path, &di); err != nil {\n\t\treturn err\n\t}\n\t// If write was successful, update own state.\n\td.state.Members[hi.RemoteUnit] = hi.ChangeVersion\n\tif hi.Kind == hooks.Relati... |
{
"audio": "",
"image": "",
"text": "func (d *OvsDriver) GlobalConfigUpdate(inst core.InstanceInfo) error {\n\t// convert the netplugin config to ofnet config\n\t// currently, its only ArpMode\n\tvar cfg ofnet.OfnetGlobalConfig\n\tswitch inst.ArpMode {\n\tcase \"flood\":\n\t",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tcfg.ArpMode = ofnet.ArpFlood\n\tdefault:\n\t\t// set the default to proxy for graceful upgrade\n\t\tcfg.ArpMode = ofnet.ArpProxy\n\t}\n\n\terrs := \"\"\n\tfor _, sw := range d.switchDb {\n\t\terr := sw.GlobalConfigUpdate(cfg)\n\t\tif err != nil {\n\t\t\terrs += err.Error()\n... | {
"audio": "",
"image": "",
"text": " := range s.data.Instances[service] {\n\t\tif leader == nil || inst.Index < leader.Index {\n\t\t\tleader = inst\n\t\t}\n\t}\n\n\t// Retrieve the leader ID.\n\tvar leaderID string\n\tif leader != nil {\n\t\tleaderID = leader.ID\n\t}\n\n\t// Set leader.\n\ts.data.Leaders[service... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.