Ejemplo n.º 1
0
    def GetParameterNames(self, xml, req):
        """Process a GetParameterNames request."""
        path = unicode(req.ParameterPath)
        nextlevel = cwmpbool.parse(req.NextLevel)
        # Spec: If NextLevel is true and ParameterPath is a Parameter name
        # rather than apartial path, the CPE MUST return a fault response
        # with the Invalid Arguments fault code(9003).
        if nextlevel is True and path and not path.endswith('.'):
            return soap.SimpleFault(xml,
                                    soap.CpeFault.INVALID_ARGUMENTS,
                                    faultstring='No such parameter: %s' %
                                    unicode(path))
        names = list(self.impl.GetParameterNames(path, nextlevel))

        soaptype = 'ParameterInfoStruct[{0}]'.format(len(names))
        parameter_list_attrs = {'soap-enc:arrayType': soaptype}
        with xml['cwmp:GetParameterNamesResponse']:
            with xml.ParameterList(**parameter_list_attrs):
                for name in names:
                    with xml['ParameterInfoStruct']:
                        xml.Name(name)
                        xml.Writable(
                            '1'
                        )  # TODO(apenwarr): detect true writability here
        return xml
Ejemplo n.º 2
0
 def testParse(self):
     self.assertTrue(cwmpbool.parse('true'))
     self.assertTrue(cwmpbool.parse('True'))
     self.assertTrue(cwmpbool.parse('1'))
     self.assertFalse(cwmpbool.parse('false'))
     self.assertFalse(cwmpbool.parse('False'))
     self.assertFalse(cwmpbool.parse('0'))
     self.assertRaises(ValueError, cwmpbool.parse, 'booga')
Ejemplo n.º 3
0
 def testParse(self):
   self.assertTrue(cwmpbool.parse('true'))
   self.assertTrue(cwmpbool.parse('True'))
   self.assertTrue(cwmpbool.parse('1'))
   self.assertFalse(cwmpbool.parse('false'))
   self.assertFalse(cwmpbool.parse('False'))
   self.assertFalse(cwmpbool.parse('0'))
   self.assertRaises(ValueError, cwmpbool.parse, 'booga')
Ejemplo n.º 4
0
 def GetParameterNames(self, xml, req):
   path = str(req.ParameterPath)
   if path.endswith('.'):
     path = path[:-1]
   nextlevel = cwmpbool.parse(req.NextLevel)
   names = list(self.impl.GetParameterNames(path, nextlevel))
   soaptype = 'ParameterInfoStruct[{0}]'.format(len(names))
   parameter_list_attrs = {'soap-enc:arrayType': soaptype}
   with xml['cwmp:GetParameterNamesResponse']:
     with xml.ParameterList(**parameter_list_attrs):
       for name in names:
         with xml['ParameterInfoStruct']:
           xml.Name(name)
           xml.Writable('1')  # TODO(apenwarr): detect true writability here
   return xml
Ejemplo n.º 5
0
 def GetParameterNames(self, xml, req):
   path = str(req.ParameterPath)
   if path.endswith('.'):
     path = path[:-1]
   nextlevel = cwmpbool.parse(req.NextLevel)
   names = list(self.impl.GetParameterNames(path, nextlevel))
   soaptype = 'ParameterInfoStruct[{0}]'.format(len(names))
   parameter_list_attrs = {'soap-enc:arrayType': soaptype}
   with xml['cwmp:GetParameterNamesResponse']:
     with xml.ParameterList(**parameter_list_attrs):
       for name in names:
         with xml['ParameterInfoStruct']:
           xml.Name(name)
           xml.Writable('1')  # TODO(apenwarr): detect true writability here
   return xml
Ejemplo n.º 6
0
 def SetPeriodicInformEnable(self, value):
     self.config._PeriodicInformEnable = cwmpbool.parse(value)
     self.ConfigurePeriodicInform()
Ejemplo n.º 7
0
 def SetPeriodicInformEnable(self, value):
   self.config._PeriodicInformEnable = cwmpbool.parse(value)
   self.ConfigurePeriodicInform()