code: def setup_link(self, interface, cidr):
          
          # clear old ipaddr in interface
          cmd = ['ip', 'addr', 'flush', 'dev', interface]
          agent_utils.execute(cmd, root=True)
          ip = IPNetwork(cidr)
          cmd = ['ip', 'addr', 'add', cidr, 'broadcast',
                 str(ip.broadcast), 'dev', interface]
          stdcode, stdout = agent_utils.execute(cmd, root=True)
          if stdcode == 0:
              cmd = ['ip', 'link', 'set', 'dev', interface, 'up']
              stdcode, stdout = agent_utils.execute(cmd, root=True)
              if stdcode == 0:
                  return agent_utils.make_response(code=stdcode)
          # execute failed.
          message = stdout.pop(0)
          return agent_utils.make_response(code=stdcode, message=message)
docs: Setup a link.
  
          ip addr add dev interface
          ip link  set dev interface up