mpsdn_controller.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:multipath-sdn-controller 作者: dariobanfi 项目源码 文件源码
def change_bucket_weight(self, req, **kwargs):
        '''
        Changes bucket weight for a datapath's GROUP
        Rules are passed in this format port,weight; :
        Example : '1,1;2,1;3,2;4,2'
        '''
        multipath_controller = self.mp_instance

        try:
            dp_id = kwargs['dp_id']
            group_id = kwargs['group_id']
            arg_rules = kwargs['rules']
            rules = {}
            for i in arg_rules.split(';'):
                rules[int(i.split(',')[0])] = int(i.split(',')[1])

            multipath_controller.topo_shape.modify_group(
                multipath_controller.topo_shape.dpid_to_switch[
                    int(dp_id)].dp, int(group_id), rules)
        except:
            traceback.print_exc()

        return Response(content_type='text/html', body='Done!\n')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号