Loading go-apps/meep-tc-engine/ip-mgr.go +10 −10 Original line number Diff line number Diff line Loading @@ -61,8 +61,8 @@ func NewIpManager(name string, sandboxName string, updateCb IpAddrUpdateCb) (im return im, nil } // SetPodList - Set list of pods to monitor IP addresses for func (im *IpManager) SetPodList(podList map[string]bool) { // RefreshPodList - Set list of pods to monitor IP addresses for func (im *IpManager) RefreshPodList(podList map[string]bool) { im.mutex.Lock() defer im.mutex.Unlock() Loading @@ -70,6 +70,8 @@ func (im *IpManager) SetPodList(podList map[string]bool) { for podName := range im.podIpMap { if _, found := podList[podName]; !found { delete(im.podIpMap, podName) } else { delete(podList, podName) } } Loading @@ -81,8 +83,8 @@ func (im *IpManager) SetPodList(podList map[string]bool) { } } // SetSvcList - Set list of services to monitor IP addresses for func (im *IpManager) SetSvcList(svcList map[string]bool) { // RefreshSvcList - Set list of services to monitor IP addresses for func (im *IpManager) RefreshSvcList(svcList map[string]bool) { im.mutex.Lock() defer im.mutex.Unlock() Loading @@ -90,6 +92,8 @@ func (im *IpManager) SetSvcList(svcList map[string]bool) { for svcName := range im.svcIpMap { if _, found := svcList[svcName]; !found { delete(im.svcIpMap, svcName) } else { delete(svcList, svcName) } } Loading Loading @@ -135,12 +139,8 @@ func (im *IpManager) Start() error { im.ticker = time.NewTicker(DEFAULT_TICKER_INTERVAL_MS * time.Millisecond) go func() { for range im.ticker.C { im.mutex.Lock() // Refresh IP addresses im.refreshIpAddresses() im.mutex.Unlock() im.Refresh() } }() Loading Loading @@ -182,7 +182,7 @@ func (im *IpManager) refreshIpAddresses() { } // Retrieve all sandbox pods from k8s api podList, err := im.clientset.CoreV1().Pods(im.sandboxName).List(metav1.ListOptions{}) podList, err := im.clientset.CoreV1().Pods(im.sandboxName).List(metav1.ListOptions{LabelSelector: "meepOrigin=scenario"}) if err != nil { log.Error("Failed to retrieve pods from k8s API Server. Error: ", err) im.isConnected = false Loading go-apps/meep-tc-engine/tc-engine.go +4 −4 Original line number Diff line number Diff line Loading @@ -376,8 +376,8 @@ func stopScenario() { mgSvcInfoMap = make(map[string]*MgServiceInfo) podInfoMap = make(map[string]*PodInfo) tce.ipManager.SetPodList(map[string]bool{}) tce.ipManager.SetSvcList(map[string]bool{}) tce.ipManager.RefreshPodList(map[string]bool{}) tce.ipManager.RefreshSvcList(map[string]bool{}) tce.netCharStore.rc.DBFlush(tce.netCharStore.baseKey) Loading Loading @@ -506,8 +506,8 @@ func processScenario(model *mod.Model) error { } // Update Pod & Svc lists in IP Manager tce.ipManager.SetPodList(podNames) tce.ipManager.SetSvcList(svcNames) tce.ipManager.RefreshPodList(podNames) tce.ipManager.RefreshSvcList(svcNames) // Remove network elements that are no longer in scenario for procName := range netElemMap { Loading go-apps/meep-tc-sidecar/main.go +1 −3 Original line number Diff line number Diff line Loading @@ -264,9 +264,7 @@ func initMeepSidecar() (err error) { log.Error("Failed to create Pinger. Error: ", err) return err } if pinger.PayloadSize() != uint16(opts.payloadSize) { pinger.SetPayloadSize(uint16(opts.payloadSize)) } // Initialize filters err = initializeFilters() Loading Loading
go-apps/meep-tc-engine/ip-mgr.go +10 −10 Original line number Diff line number Diff line Loading @@ -61,8 +61,8 @@ func NewIpManager(name string, sandboxName string, updateCb IpAddrUpdateCb) (im return im, nil } // SetPodList - Set list of pods to monitor IP addresses for func (im *IpManager) SetPodList(podList map[string]bool) { // RefreshPodList - Set list of pods to monitor IP addresses for func (im *IpManager) RefreshPodList(podList map[string]bool) { im.mutex.Lock() defer im.mutex.Unlock() Loading @@ -70,6 +70,8 @@ func (im *IpManager) SetPodList(podList map[string]bool) { for podName := range im.podIpMap { if _, found := podList[podName]; !found { delete(im.podIpMap, podName) } else { delete(podList, podName) } } Loading @@ -81,8 +83,8 @@ func (im *IpManager) SetPodList(podList map[string]bool) { } } // SetSvcList - Set list of services to monitor IP addresses for func (im *IpManager) SetSvcList(svcList map[string]bool) { // RefreshSvcList - Set list of services to monitor IP addresses for func (im *IpManager) RefreshSvcList(svcList map[string]bool) { im.mutex.Lock() defer im.mutex.Unlock() Loading @@ -90,6 +92,8 @@ func (im *IpManager) SetSvcList(svcList map[string]bool) { for svcName := range im.svcIpMap { if _, found := svcList[svcName]; !found { delete(im.svcIpMap, svcName) } else { delete(svcList, svcName) } } Loading Loading @@ -135,12 +139,8 @@ func (im *IpManager) Start() error { im.ticker = time.NewTicker(DEFAULT_TICKER_INTERVAL_MS * time.Millisecond) go func() { for range im.ticker.C { im.mutex.Lock() // Refresh IP addresses im.refreshIpAddresses() im.mutex.Unlock() im.Refresh() } }() Loading Loading @@ -182,7 +182,7 @@ func (im *IpManager) refreshIpAddresses() { } // Retrieve all sandbox pods from k8s api podList, err := im.clientset.CoreV1().Pods(im.sandboxName).List(metav1.ListOptions{}) podList, err := im.clientset.CoreV1().Pods(im.sandboxName).List(metav1.ListOptions{LabelSelector: "meepOrigin=scenario"}) if err != nil { log.Error("Failed to retrieve pods from k8s API Server. Error: ", err) im.isConnected = false Loading
go-apps/meep-tc-engine/tc-engine.go +4 −4 Original line number Diff line number Diff line Loading @@ -376,8 +376,8 @@ func stopScenario() { mgSvcInfoMap = make(map[string]*MgServiceInfo) podInfoMap = make(map[string]*PodInfo) tce.ipManager.SetPodList(map[string]bool{}) tce.ipManager.SetSvcList(map[string]bool{}) tce.ipManager.RefreshPodList(map[string]bool{}) tce.ipManager.RefreshSvcList(map[string]bool{}) tce.netCharStore.rc.DBFlush(tce.netCharStore.baseKey) Loading Loading @@ -506,8 +506,8 @@ func processScenario(model *mod.Model) error { } // Update Pod & Svc lists in IP Manager tce.ipManager.SetPodList(podNames) tce.ipManager.SetSvcList(svcNames) tce.ipManager.RefreshPodList(podNames) tce.ipManager.RefreshSvcList(svcNames) // Remove network elements that are no longer in scenario for procName := range netElemMap { Loading
go-apps/meep-tc-sidecar/main.go +1 −3 Original line number Diff line number Diff line Loading @@ -264,9 +264,7 @@ func initMeepSidecar() (err error) { log.Error("Failed to create Pinger. Error: ", err) return err } if pinger.PayloadSize() != uint16(opts.payloadSize) { pinger.SetPayloadSize(uint16(opts.payloadSize)) } // Initialize filters err = initializeFilters() Loading