@@ -101,31 +101,6 @@ func (s *StrategyChoiceModule) set(interest *Interest) {
101101 return
102102 }
103103
104- switch s .kind {
105- case strategyChoiceMulticast :
106- if ! params .Strategy .Name .Equal (defn .BROADCAST_STRATEGY ) && ! params .Strategy .Name .Equal (defn .BIER_STRATEGY ) {
107- core .Log .Warn (s , "Invalid multicast strategy" , "strategy" , params .Strategy .Name )
108- s .manager .sendCtrlResp (interest , 404 , "Invalid multicast strategy" , nil )
109- return
110- }
111-
112- table .MulticastStrategyTable .SetStrategyEnc (params .Name , params .Strategy .Name )
113-
114- s .manager .sendCtrlResp (interest , 200 , "OK" , & mgmt.ControlArgs {
115- Name : params .Name ,
116- Strategy : params .Strategy ,
117- })
118-
119- core .Log .Info (s , "Set multicast strategy" , "name" , params .Name , "strategy" , params .Strategy .Name )
120- return
121- case strategyChoiceUnicast :
122- // fallthrough to unicast handling below
123- default :
124- core .Log .Warn (s , "Unknown strategy choice kind" , "kind" , s .kind )
125- s .manager .sendCtrlResp (interest , 500 , "Internal error" , nil )
126- return
127- }
128-
129104 if ! defn .STRATEGY_PREFIX .IsPrefix (params .Strategy .Name ) {
130105 core .Log .Warn (s , "Invalid strategy" , "strategy" , params .Strategy .Name )
131106 s .manager .sendCtrlResp (interest , 404 , "Invalid strategy" , nil )
@@ -175,14 +150,26 @@ func (s *StrategyChoiceModule) set(interest *Interest) {
175150 params .Strategy .Name = params .Strategy .Name .
176151 Append (enc .NewVersionComponent (strategyVersion ))
177152 }
178- table .FibStrategyTable .SetStrategyEnc (params .Name , params .Strategy .Name )
153+
154+ switch s .kind {
155+ case strategyChoiceMulticast :
156+ table .MulticastStrategyTable .SetStrategyEnc (params .Name , params .Strategy .Name )
157+ core .Log .Info (s , "Set multicast strategy" , "name" , params .Name , "strategy" , params .Strategy .Name )
158+
159+ case strategyChoiceUnicast :
160+ table .FibStrategyTable .SetStrategyEnc (params .Name , params .Strategy .Name )
161+ core .Log .Info (s , "Set strategy" , "name" , params .Name , "strategy" , params .Strategy .Name )
162+
163+ default :
164+ core .Log .Warn (s , "Unknown strategy choice kind" , "kind" , s .kind )
165+ s .manager .sendCtrlResp (interest , 500 , "Internal error" , nil )
166+ return
167+ }
179168
180169 s .manager .sendCtrlResp (interest , 200 , "OK" , & mgmt.ControlArgs {
181170 Name : params .Name ,
182171 Strategy : params .Strategy ,
183172 })
184-
185- core .Log .Info (s , "Set strategy" , "name" , params .Name , "strategy" , params .Strategy .Name )
186173}
187174
188175// (AI GENERATED DESCRIPTION): Unsets a strategy encoding for a given name by handling a control interest, validating its parameters, removing the strategy from the FIB strategy table, and replying with a 200 OK response.
0 commit comments