예제 #1
0
 def test_onelsit_pos(self):
     # READ
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     e_1, e_2 = ysanity.Runner.OneList.Ldata(), ysanity.Runner.OneList.Ldata()
     e_1.number = 1
     e_1.name = 'runner:onelist:ldata['+str(e_1.number)+']:name'
     e_2.number = 2
     e_2.name = 'runner:onelist:ldata['+str(e_2.number)+']:name'
     r_1.one_list.ldata.extend([e_1, e_2])
     self.crud.create(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # UPDATE
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     e_1, e_2 = ysanity.Runner.OneList.Ldata(), ysanity.Runner.OneList.Ldata()
     e_1.number = 1
     e_1.name = 'runner:onelist:ldata['+str(e_1.number)+']:name'
     e_2.number = 2
     e_2.name = 'runner:onelist:ldata['+str(e_2.number)+']:name'
     r_1.one_list.ldata.extend([e_1, e_2])
     self.crud.update(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # DELETE
     r_1 = ysanity.Runner()
     self.crud.delete(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_1)
     self.assertEqual(r_2._has_data(), False)
예제 #2
0
 def test_aug_onelist_pos(self):
     # CREATE
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     e_1 = ysanity.Runner.OneList.OneAugList.Ldata()
     e_2 = ysanity.Runner.OneList.OneAugList.Ldata()
     e_1.number = 1
     e_1.name = e_1._common_path
     e_2.number = 2
     e_2.name = e_2._common_path
     r_1.one_list.one_aug_list.ldata.extend([e_1, e_2])
     r_1.one_list.one_aug_list.enabled = True
     self.crud.create(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # UPDATE
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     e_1 = ysanity.Runner.OneList.OneAugList.Ldata()
     e_2 = ysanity.Runner.OneList.OneAugList.Ldata()
     e_1.number = 1
     e_1.name = e_1._common_path.replace(':', '/')
     e_2.number = 2
     e_2.name = e_2._common_path.replace(':', '/')
     r_1.one_list.one_aug_list.ldata.extend([e_1, e_2])
     r_1.one_list.one_aug_list.enabled = True
     self.crud.update(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # DELETE
     r_1 = ysanity.Runner()
     self.crud.delete(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(r_2._has_data(), False)
예제 #3
0
 def test_aug_onelist_pos(self):
     # CREATE
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     e_1 = ysanity.Runner.OneList.OneAugList.Ldata()
     e_2 = ysanity.Runner.OneList.OneAugList.Ldata()
     e_1.number = 1
     e_1.name = e_1._common_path
     e_2.number = 2
     e_2.name = e_2._common_path
     r_1.one_list.one_aug_list.ldata.extend([e_1, e_2])
     r_1.one_list.one_aug_list.enabled = True
     self.crud.create(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # UPDATE
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     e_1 = ysanity.Runner.OneList.OneAugList.Ldata()
     e_2 = ysanity.Runner.OneList.OneAugList.Ldata()
     e_1.number = 1
     e_1.name = e_1._common_path.replace(':', '/')
     e_2.number = 2
     e_2.name = e_2._common_path.replace(':', '/')
     r_1.one_list.one_aug_list.ldata.extend([e_1, e_2])
     r_1.one_list.one_aug_list.enabled = True
     self.crud.update(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # DELETE
     r_1 = ysanity.Runner()
     self.crud.delete(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(r_2._has_data(), False)
예제 #4
0
 def test_onelsit_pos(self):
     # READ
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     e_1, e_2 = ysanity.Runner.OneList.Ldata(
     ), ysanity.Runner.OneList.Ldata()
     e_1.number = 1
     e_1.name = 'runner:onelist:ldata[' + str(e_1.number) + ']:name'
     e_2.number = 2
     e_2.name = 'runner:onelist:ldata[' + str(e_2.number) + ']:name'
     r_1.one_list.ldata.extend([e_1, e_2])
     self.crud.create(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # UPDATE
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     e_1, e_2 = ysanity.Runner.OneList.Ldata(
     ), ysanity.Runner.OneList.Ldata()
     e_1.number = 1
     e_1.name = 'runner:onelist:ldata[' + str(e_1.number) + ']:name'
     e_2.number = 2
     e_2.name = 'runner:onelist:ldata[' + str(e_2.number) + ']:name'
     r_1.one_list.ldata.extend([e_1, e_2])
     self.crud.update(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # DELETE
     r_1 = ysanity.Runner()
     self.crud.delete(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_1)
     self.assertEqual(r_2._has_data(), False)
예제 #5
0
 def test_twolist_pos(self):
     # READ
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     e_1, e_2 = ysanity.Runner.TwoList.Ldata(), ysanity.Runner.TwoList.Ldata()
     e_11, e_12 = ysanity.Runner.TwoList.Ldata.Subl1(), ysanity.Runner.TwoList.Ldata.Subl1()
     e_1.number = 21
     e_1.name = 'runner:twolist:ldata['+str(e_1.number)+']:name'
     e_11.number = 211 
     e_11.name = 'runner:twolist:ldata['+str(e_1.number)+']:subl1['+str(e_11.number)+']:name'
     e_12.number = 212
     e_12.name = 'runner:twolist:ldata['+str(e_1.number)+']:subl1['+str(e_12.number)+']:name'
     e_1.subl1.extend([e_11, e_12])
     e_21, e_22 = ysanity.Runner.TwoList.Ldata.Subl1(), ysanity.Runner.TwoList.Ldata.Subl1()
     e_2.number = 22
     e_2.name = 'runner:twolist:ldata['+str(e_2.number)+']:name'
     e_21.number = 221
     e_21.name = 'runner:twolist:ldata['+str(e_2.number)+']:subl1['+str(e_21.number)+']:name'
     e_22.number = 222
     e_22.name = 'runner:twolist:ldata['+str(e_2.number)+']:subl1['+str(e_22.number)+']:name'
     e_2.subl1.extend([e_21, e_22])
     r_1.two_list.ldata.extend([e_1, e_2])
     self.crud.create(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # UPDATE
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     e_1, e_2 = ysanity.Runner.TwoList.Ldata(), ysanity.Runner.TwoList.Ldata()
     e_11, e_12 = ysanity.Runner.TwoList.Ldata.Subl1(), ysanity.Runner.TwoList.Ldata.Subl1()
     e_1.number = 21
     e_1.name = 'runner/twolist/ldata['+str(e_1.number)+']/name'
     e_11.number = 211
     e_11.name = 'runner/twolist/ldata['+str(e_1.number)+']/subl1['+str(e_11.number)+']/name'
     e_12.number = 212
     e_12.name = 'runner/twolist/ldata['+str(e_1.number)+']/subl1['+str(e_12.number)+']/name'
     e_1.subl1.extend([e_11, e_12])
     e_21, e_22 = ysanity.Runner.TwoList.Ldata.Subl1(), ysanity.Runner.TwoList.Ldata.Subl1()
     e_2.number = 22
     e_2.name = 'runner/twolist/ldata['+str(e_2.number)+']/name'
     e_21.number = 221
     e_21.name = 'runner/twolist/ldata['+str(e_2.number)+']/subl1['+str(e_21.number)+']/name'
     e_22.number = 222
     e_22.name = 'runner/twolist/ldata['+str(e_2.number)+']/subl1['+str(e_22.number)+']/name'
     e_2.subl1.extend([e_21, e_22])
     r_1.two_list.ldata.extend([e_1, e_2])
     self.crud.update(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # DELETE
     r_1 = ysanity.Runner()
     self.crud.delete(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_1)
     self.assertEqual(r_2._has_data(), False)
예제 #6
0
    def test_read_on_identity_ref(self):
        r_1 = ysanity.Runner.Ytypes.BuiltInT()
        r_1.identity_ref_value = ysanity.ChildIdentity_Identity()
        self.crud.create(self.ncc, r_1)
        r_2 = ysanity.Runner.Ytypes.BuiltInT()
        r_2.identity_ref_value = READ()
        r_2 = self.crud.read(self.ncc, r_2)
        self.assertEqual(is_equal(r_1, r_2), True)

        r_2 = ysanity.Runner.Ytypes.BuiltInT()
        r_2.identity_ref_value = ysanity.ChildIdentity_Identity()
        r_2 = self.crud.read(self.ncc, r_2)
        self.assertEqual(is_equal(r_1, r_2), True)
예제 #7
0
    def test_read_on_identity_ref(self):
        r_1 = ysanity.Runner.Ytypes.BuiltInT()
        r_1.identity_ref_value = ysanity.ChildIdentity_Identity()
        self.crud.create(self.ncc, r_1)
        r_2 = ysanity.Runner.Ytypes.BuiltInT()
        r_2.identity_ref_value = READ()
        r_2 = self.crud.read(self.ncc, r_2)
        self.assertEqual(is_equal(r_1, r_2), True)

        r_2 = ysanity.Runner.Ytypes.BuiltInT()
        r_2.identity_ref_value = ysanity.ChildIdentity_Identity()
        r_2 = self.crud.read(self.ncc, r_2)
        self.assertEqual(is_equal(r_1, r_2), True)
예제 #8
0
    def test_read_on_leaflist(self):
        r_1 = ysanity.Runner.Ytypes.BuiltInT()
        r_1.llstring = ['1', '2', '3']
        self.crud.create(self.ncc, r_1)
        r_2 = ysanity.Runner.Ytypes.BuiltInT()
        r_2.llstring = READ()
        r_2 = self.crud.read(self.ncc, r_2)
        self.assertEqual(is_equal(r_1, r_2), True)

        r_2 = ysanity.Runner.Ytypes.BuiltInT()
        # invalid input, user should use READ() 
        # or the same data on device
        r_2.llstring = ['something emaillse']
        r_2 = self.crud.read(self.ncc, r_2)
        self.assertNotEqual(is_equal(r_1, r_2), True)
예제 #9
0
    def test_read_on_leaflist(self):
        r_1 = ysanity.Runner.Ytypes.BuiltInT()
        r_1.llstring = ['1', '2', '3']
        self.crud.create(self.ncc, r_1)
        r_2 = ysanity.Runner.Ytypes.BuiltInT()
        r_2.llstring = READ()
        r_2 = self.crud.read(self.ncc, r_2)
        self.assertEqual(is_equal(r_1, r_2), True)

        r_2 = ysanity.Runner.Ytypes.BuiltInT()
        # invalid input, user should use READ()
        # or the same data on device
        r_2.llstring = ['something emaillse']
        r_2 = self.crud.read(self.ncc, r_2)
        self.assertNotEqual(is_equal(r_1, r_2), True)
예제 #10
0
    def test_delete_operation_on_list(self):
        # create runner with a container and a list
        runner_create = ysanity.Runner()
        runner_create.one.name = 'one'

        elem1 = ysanity.Runner.OneList.Ldata()
        elem2 = ysanity.Runner.OneList.Ldata()
        elem1.number = 1
        elem2.name = 'foo'
        elem2.number = 1
        elem2.name = 'bar'
        runner_create.one_list.ldata.extend([elem1, elem2])

        self.crud.create(self.ncc, runner_create)

        runner_read_filter = ysanity.Runner()
        runner_read = self.crud.read(self.ncc, runner_read_filter)

        self.crud.delete(self.ncc, runner_read.one_list.ldata)

        runner_read = self.crud.read(self.ncc, runner_read_filter)
        runner_left = runner_create
        del runner_left.one_list.ldata[:]

        self.assertEqual(is_equal(runner_read, runner_left), True)
예제 #11
0
 def test_CASE6(self):
     a = ysanity.A()
     a.b.c = a.b.C()
     a = self.crud.read(self.ncc, a)
     _a = ysanity.A()
     _a.b.c = _a.b.C()
     self.assertEqual(is_equal(a, _a), True)
예제 #12
0
    def test_delete_operation_on_list(self):
        # create runner with a container and a list
        runner_create = ysanity.Runner()
        runner_create.one.name = 'one'

        elem1 = ysanity.Runner.OneList.Ldata()
        elem2 = ysanity.Runner.OneList.Ldata()
        elem1.number = 1
        elem2.name = 'foo'
        elem2.number = 1
        elem2.name = 'bar'
        runner_create.one_list.ldata.extend([elem1, elem2])

        self.crud.create(self.ncc, runner_create)

        runner_read_filter = ysanity.Runner()
        runner_read = self.crud.read(self.ncc, runner_read_filter)

        self.crud.delete(self.ncc, runner_read.one_list.ldata)

        runner_read = self.crud.read(self.ncc, runner_read_filter)
        runner_left = runner_create
        del runner_left.one_list.ldata[:]

        self.assertEqual(is_equal(runner_read, runner_left), True)
예제 #13
0
 def test_CASE3(self):
     a = ysanity.A()
     a.a1 = READ()
     a = self.crud.read(self.ncc, a)
     _a = ysanity.A()
     _a.a1 = "some value"
     self.assertEqual(is_equal(a, _a), True)
예제 #14
0
    def test_delete_operation_on_list_slice(self):
        runner_create = ysanity.Runner()
        runner_create.one.name = 'one'

        foo = ysanity.Runner.OneList.Ldata()
        bar = ysanity.Runner.OneList.Ldata()
        baz = ysanity.Runner.OneList.Ldata()
        foo.number = 1
        foo.name = 'foo'
        bar.number = 2
        bar.name = 'bar'
        baz.number = 3
        baz.name = 'baz'
        runner_create.one_list.ldata.extend([foo, bar, baz])

        self.crud.create(self.ncc, runner_create)

        runner_read = self.read_from_empty_filter()

        elements_to_delete = runner_read.one_list.ldata[:1]
        self.crud.delete(self.ncc, elements_to_delete)

        # read after a crud delete operation
        runner_read = self.read_from_empty_filter()
        runner_left = runner_create
        # manually delete entire list
        del runner_left.one_list.ldata[:1]

        self.assertEqual(is_equal(runner_read, runner_left), True)
예제 #15
0
 def test_CASE4(self):
     a = ysanity.A()
     a.b.b1 = "some value"
     a = self.crud.read(self.ncc, a)
     _a = self.getInitEntity()
     _a.lst, _a.a1, _a.a2, _a.a3 = YList(), None, None, None
     self.assertEqual(is_equal(a, _a), True)
예제 #16
0
 def test_CASE2(self):
     a = ysanity.A()
     a.a1 = "some value"
     a = self.crud.read(self.ncc, a)
     # the whole thing        
     _a = self.getInitEntity()
     self.assertEqual(is_equal(a, _a), True)
예제 #17
0
    def test_delete_operation_on_list_slice(self):
        runner_create = ysanity.Runner()
        runner_create.one.name = 'one'

        foo = ysanity.Runner.OneList.Ldata()
        bar = ysanity.Runner.OneList.Ldata()
        baz = ysanity.Runner.OneList.Ldata()
        foo.number = 1
        foo.name = 'foo'
        bar.number = 2
        bar.name = 'bar'
        baz.number = 3
        baz.name = 'baz'
        runner_create.one_list.ldata.extend([foo, bar, baz])

        self.crud.create(self.ncc, runner_create)

        runner_read = self.read_from_empty_filter()

        elements_to_delete = runner_read.one_list.ldata[:1]
        self.crud.delete(self.ncc, elements_to_delete)

        # read after a crud delete operation
        runner_read = self.read_from_empty_filter()
        runner_left = runner_create
        # manually delete entire list
        del runner_left.one_list.ldata[:1]

        self.assertEqual(is_equal(runner_read, runner_left), True)
예제 #18
0
 def test_CASE5(self):
     a = ysanity.A()
     e = a.b.d.e
     e.e1 = "some value e1"
     a = self.crud.read(self.ncc, a)
     _a = ysanity.A()
     _a.b.d.e.e1, _a.b.d.e.e2 = "some value e1", "value of e2"
     self.assertEqual(is_equal(a, _a), True)        
예제 #19
0
 def test_one_level_pos(self):
     # READ
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     r_1.one.number, r_1.one.name = 1, 'runner:one:name'
     self.crud.create(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # UPDATE
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     r_1.one.number, r_1.one.name = 10, 'runner/one/name'
     self.crud.update(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # DELETE
     r_1 = ysanity.Runner()
     self.crud.delete(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_1)
     self.assertEqual(r_2._has_data(), False)
예제 #20
0
    def test_edit_commit_get(self):
        runner = ysanity.Runner()
        runner.one.number = 1
        runner.one.name = 'runner:one:name'

        get_filter = ysanity.Runner()

        op = self.netconf_service.edit_config(self.ncc, Datastore.candidate, runner)
        self.assertIn('ok', op)

        result = self.netconf_service.get_config(self.ncc, Datastore.candidate, get_filter)
        self.assertEqual(is_equal(runner, result), True)

        op = self.netconf_service.commit(self.ncc)
        self.assertIn('ok', op)

        result = self.netconf_service.get(self.ncc, get_filter)
        self.assertEqual(is_equal(runner, result), True)
예제 #21
0
 def test_one_level_pos(self):
     # READ
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     r_1.one.number, r_1.one.name = 1, 'runner:one:name'
     self.crud.create(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # UPDATE
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     r_1.one.number, r_1.one.name = 10, 'runner/one/name'
     self.crud.update(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # DELETE
     r_1 = ysanity.Runner()
     self.crud.delete(self.ncc,r_1)
     r_2 = self.crud.read(self.ncc, r_1)
     self.assertEqual(r_2._has_data(), False)
예제 #22
0
    def test_read_on_ref_class(self):
        r_1 = ysanity.Runner()
        r_1.one.number, r_1.one.name = 1, 'runner:one:name'
        self.crud.create(self.ncc, r_1)
        r_2 = ysanity.Runner()

        r_2.one = READ()
        r_2 = self.crud.read(self.ncc, r_2)
        self.assertEqual(is_equal(r_1, r_2), True)
예제 #23
0
    def test_read_on_ref_class(self):
        r_1 = ysanity.Runner()
        r_1.one.number, r_1.one.name = 1, 'runner:one:name'
        self.crud.create(self.ncc, r_1)
        r_2 = ysanity.Runner()

        r_2.one = READ()
        r_2 = self.crud.read(self.ncc, r_2)
        self.assertEqual(is_equal(r_1, r_2), True)
예제 #24
0
 def test_two_level_pos(self):
     # READ
     r_1 = ysanity.Runner()
     r_1.two.number, r_1.two.name, r_1.two.sub1.number = 2, 'runner:two:name', 21
     self.crud.create(self.ncc, r_1)
     r_2 = ysanity.Runner()
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # UPDATE
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     r_1.two.number, r_1.two.name, r_1.two.sub1.number = 20, 'runner/two/name', 210
     self.crud.update(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # DELETE
     r_1 = ysanity.Runner()
     self.crud.delete(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_1)
     self.assertEqual(r_2._has_data(), False)
예제 #25
0
 def test_CASE7(self):
     a = ysanity.A()
     l1, l2 = a.Lst(), a.Lst()
     l1.number, l2.number = 1, 2
     a.lst.extend([l1, l2])
     a = self.crud.read(self.ncc, a)
     _a = ysanity.A()
     l1.value, l2.value = "one", "two"
     _a.lst.extend([l1, l2])
     self.assertEqual(is_equal(a, _a), True)
예제 #26
0
 def test_two_level_pos(self):
     # READ
     r_1 = ysanity.Runner()
     r_1.two.number, r_1.two.name, r_1.two.sub1.number = 2, 'runner:two:name', 21
     self.crud.create(self.ncc, r_1)
     r_2 = ysanity.Runner()
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # UPDATE
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     r_1.two.number, r_1.two.name, r_1.two.sub1.number = 20, 'runner/two/name', 210
     self.crud.update(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # DELETE
     r_1 = ysanity.Runner()
     self.crud.delete(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_1)
     self.assertEqual(r_2._has_data(), False)
예제 #27
0
 def test_aug_one_pos(self): 
     # CREATE
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     r_1.one.one_aug.number = 1
     r_1.one.one_aug.name =r_1.one.one_aug._common_path
     self.crud.create(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # UPDATE
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     r_1.one.one_aug.number = 10
     r_1.one.one_aug.name =r_1.one.one_aug._common_path.replace(':', '/')
     self.crud.update(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)        
     # DELETE
     r_1 = ysanity.Runner()
     self.crud.delete(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_1)
     self.assertEqual(r_2._has_data(), False)
예제 #28
0
    def test_read_only_config(self):
        r_1 = ysanity.Runner()
        r_1.one.number, r_1.one.name = 1, 'runner:one:name'
        self.crud.create(self.ncc, r_1)
        r_2, r_3 = ysanity.Runner(), ysanity.Runner()
        r_2.one.number, r_3.one.number = READ(), READ()

        r_2 = self.crud.read(self.ncc, r_2, only_config=True)
        r_3 = self.crud.read(self.ncc, r_3)
        # ysanity only have config data, ok to compare
        self.assertEqual(is_equal(r_2, r_3), True)
예제 #29
0
 def test_aug_one_pos(self):
     # CREATE
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     r_1.one.one_aug.number = 1
     r_1.one.one_aug.name = r_1.one.one_aug._common_path
     self.crud.create(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # UPDATE
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     r_1.one.one_aug.number = 10
     r_1.one.one_aug.name = r_1.one.one_aug._common_path.replace(':', '/')
     self.crud.update(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # DELETE
     r_1 = ysanity.Runner()
     self.crud.delete(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_1)
     self.assertEqual(r_2._has_data(), False)
예제 #30
0
    def test_read_only_config(self):
        r_1 = ysanity.Runner()
        r_1.one.number, r_1.one.name = 1, 'runner:one:name'
        self.crud.create(self.ncc, r_1)
        r_2, r_3 = ysanity.Runner(), ysanity.Runner()
        r_2.one.number, r_3.one.number = READ(), READ()

        r_2 = self.crud.read(self.ncc, r_2, only_config=True)
        r_3 = self.crud.read(self.ncc, r_3)
        # ysanity only have config data, ok to compare
        self.assertEqual(is_equal(r_2, r_3), True)
예제 #31
0
    def test_edit_commit_get(self):
        runner = ysanity.Runner()
        runner.one.number = 1
        runner.one.name = 'runner:one:name'

        get_filter = ysanity.Runner()

        op = self.netconf_service.edit_config(self.ncc, Datastore.candidate,
                                              runner)
        self.assertIn('ok', op)

        result = self.netconf_service.get_config(self.ncc, Datastore.candidate,
                                                 get_filter)
        self.assertEqual(is_equal(runner, result), True)

        op = self.netconf_service.commit(self.ncc)
        self.assertIn('ok', op)

        result = self.netconf_service.get(self.ncc, get_filter)
        self.assertEqual(is_equal(runner, result), True)
예제 #32
0
    def test_bits(self):
        runner = self._create_runner()
        runner.ytypes.built_in_t.bits_value['disable-nagle'] = True
        self.crud.create(self.ncc, runner)

        # Read into Runner2
        runner1 = ysanity.Runner()
        runner1 = self.crud.read(self.ncc, runner1)

        # Compare runners
        result = is_equal(runner, runner1)
        self.assertEqual(result, True)
예제 #33
0
    def test_read_on_ref_list(self):
        r_1 = ysanity.Runner.OneList()
        l_1, l_2 = ysanity.Runner.OneList.Ldata(), ysanity.Runner.OneList.Ldata()
        l_1.number, l_2.number = 1, 2
        r_1.ldata.extend([l_1, l_2])
        self.crud.create(self.ncc, r_1)

        r_2 = ysanity.Runner.OneList()
        r_2.ldata = READ()
        r_2 = self.crud.read(self.ncc, r_2)

        self.assertEqual(is_equal(r_1, r_2), True)
예제 #34
0
	def test_union(self):
		runner = self._create_runner()
		runner.ytypes.built_in_t.younion = YdkEnumTest_Enum.NONE
		self.crud.create(self.ncc, runner)

		# Read into Runner2
		runner1 = ysanity.Runner()
		runner1 = self.crud.read(self.ncc, runner1)

		# Compare runners
		result = is_equal(runner, runner1)
		self.assertEqual(result, True)
예제 #35
0
    def test_leafref(self):
        runner = self._create_runner()
        runner.ytypes.built_in_t.leaf_ref = Decimal64('3.14')
        self.crud.create(self.ncc, runner)

        # Read into Runner2
        runner1 = ysanity.Runner()
        runner1 = self.crud.read(self.ncc, runner1)

        # Compare runners
        result = is_equal(runner, runner1)
        self.assertEqual(result, True)
예제 #36
0
	def test_bits(self):
		runner = self._create_runner()
		runner.ytypes.built_in_t.bits_value['disable-nagle'] = True
		self.crud.create(self.ncc, runner)

		# Read into Runner2
		runner1 = ysanity.Runner()
		runner1 = self.crud.read(self.ncc, runner1)

		# Compare runners
		result = is_equal(runner, runner1)
		self.assertEqual(result, True)
예제 #37
0
	def test_decimal64(self):
		runner = self._create_runner()
		runner.ytypes.built_in_t.deci64 = Decimal64('3.14')
		self.crud.create(self.ncc, runner)
		
		# Read into Runner2
		runner1 = ysanity.Runner()
		runner1 = self.crud.read(self.ncc, runner1)
		
		# Compare runners
		result = is_equal(runner, runner1)
		self.assertEqual(result, True)
예제 #38
0
    def test_submodule(self):
        subtest = ysanity.SubTest()
        subtest.one_aug.name = 'test'
        subtest.one_aug.number = 3

        res = self.crud.create(self.ncc, subtest)

        subtest1 = self.crud.read(self.ncc, ysanity.SubTest())

        # Compare runners
        result = is_equal(subtest, subtest1)
        self.assertEqual(result, True)
예제 #39
0
    def test_union_int(self):
        runner = self._create_runner()
        runner.ytypes.built_in_t.enum_int_value = 2
        self.crud.create(self.ncc, runner)

        # Read into Runner2
        runner1 = ysanity.Runner()
        runner1 = self.crud.read(self.ncc, runner1)

        # Compare runners
        result = is_equal(runner, runner1)
        self.assertEqual(result, True)
예제 #40
0
 def test_three_level_pos(self):
     # READ
     r_1 = ysanity.Runner()
     r_1.three.number, r_1.three.name, \
         r_1.three.sub1.number, r_1.three.sub1.sub2.number = 3, 'runner:three:name', 31, 311
     self.crud.create(self.ncc, r_1)
     r_2 = ysanity.Runner()
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # UPDATE
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     r_1.three.number, r_1.three.name, \
         r_1.three.sub1.number, r_1.three.sub1.sub2.number = 30, 'runner/three/name', 310, 3110
     self.crud.update(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # DELETE
     r_1 = ysanity.Runner()
     self.crud.delete(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_1)
     self.assertEqual(r_2._has_data(), False)
예제 #41
0
    def test_read_on_ref_enum_class(self):
        from ydk.models.ydktest.ydktest_sanity import YdkEnumTestEnum
        r_1 = ysanity.Runner.Ytypes.BuiltInT()
        r_1.enum_value = YdkEnumTestEnum.LOCAL
        self.crud.create(self.ncc, r_1)

        r_2 = ysanity.Runner.Ytypes.BuiltInT()
        r_2.enum_value = READ()
        r_2 = self.crud.read(self.ncc, r_2)
        self.assertEqual(is_equal(r_1, r_2), True)

        r_2 = ysanity.Runner.Ytypes.BuiltInT()
        r_2.enum_value = YdkEnumTestEnum.LOCAL
        r_2 = self.crud.read(self.ncc, r_2)
        self.assertEqual(is_equal(r_1, r_2), True)

        # no such value, nothing returned
        r_2 = ysanity.Runner.Ytypes.BuiltInT()
        r_2.enum_value = YdkEnumTestEnum.REMOTE
        r_2 = self.crud.read(self.ncc, r_2)
        self.assertNotEqual(is_equal(r_1, r_2), True)
예제 #42
0
    def test_uint32(self):
        runner = self._create_runner()
        runner.ytypes.built_in_t.u_number32 = 4294967296
        self.crud.create(self.ncc, runner)

        # Read into Runner2
        runner1 = ysanity.Runner()
        runner1 = self.crud.read(self.ncc, runner1)

        # Compare runners
        result = is_equal(runner, runner1)
        self.assertEqual(result, True)
예제 #43
0
    def test_int32(self):
        runner = self._create_runner()
        runner.ytypes.built_in_t.number32 = -9223372036854775808
        self.crud.create(self.ncc, runner)

        # Read into Runner2
        runner1 = ysanity.Runner()
        runner1 = self.crud.read(self.ncc, runner1)

        # Compare runners
        result = is_equal(runner, runner1)
        self.assertEqual(result, True)
예제 #44
0
    def test_int16(self):
        runner = self._create_runner()
        runner.ytypes.built_in_t.number16 = 20000
        self.crud.create(self.ncc, runner)

        # Read into Runner2
        runner1 = ysanity.Runner()
        runner1 = self.crud.read(self.ncc, runner1)

        # Compare runners
        result = is_equal(runner, runner1)
        self.assertEqual(result, True)
예제 #45
0
 def test_three_level_pos(self):
     # READ
     r_1 = ysanity.Runner()
     r_1.three.number, r_1.three.name, \
         r_1.three.sub1.number, r_1.three.sub1.sub2.number = 3, 'runner:three:name', 31, 311
     self.crud.create(self.ncc, r_1)
     r_2 = ysanity.Runner()
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # UPDATE
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     r_1.three.number, r_1.three.name, \
         r_1.three.sub1.number, r_1.three.sub1.sub2.number = 30, 'runner/three/name', 310, 3110
     self.crud.update(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # DELETE
     r_1 = ysanity.Runner()
     self.crud.delete(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_1)
     self.assertEqual(r_2._has_data(), False)
예제 #46
0
    def test_union(self):
        runner = self._create_runner()
        runner.ytypes.built_in_t.younion = YdkEnumTestEnum.NONE
        self.crud.create(self.ncc, runner)

        # Read into Runner2
        runner1 = ysanity.Runner()
        runner1 = self.crud.read(self.ncc, runner1)

        # Compare runners
        result = is_equal(runner, runner1)
        self.assertEqual(result, True)
예제 #47
0
    def test_read_on_ref_enum_class(self):
        from ydk.models.ydktest.ydktest_sanity import YdkEnumTestEnum
        r_1 = ysanity.Runner.Ytypes.BuiltInT()
        r_1.enum_value = YdkEnumTestEnum.LOCAL
        self.crud.create(self.ncc, r_1)

        r_2 = ysanity.Runner.Ytypes.BuiltInT()
        r_2.enum_value = READ()
        r_2 = self.crud.read(self.ncc, r_2)
        self.assertEqual(is_equal(r_1, r_2), True)

        r_2 = ysanity.Runner.Ytypes.BuiltInT()
        r_2.enum_value = YdkEnumTestEnum.LOCAL
        r_2 = self.crud.read(self.ncc, r_2)
        self.assertEqual(is_equal(r_1, r_2), True)

        # no such value, nothing returned
        r_2 = ysanity.Runner.Ytypes.BuiltInT()
        r_2.enum_value = YdkEnumTestEnum.REMOTE
        r_2 = self.crud.read(self.ncc, r_2)
        self.assertNotEqual(is_equal(r_1, r_2), True)
예제 #48
0
    def test_union_int(self):
        runner = self._create_runner()
        runner.ytypes.built_in_t.enum_int_value = 2
        self.crud.create(self.ncc, runner)

        # Read into Runner2
        runner1 = ysanity.Runner()
        runner1 = self.crud.read(self.ncc, runner1)

        # Compare runners
        result = is_equal(runner, runner1)
        self.assertEqual(result, True)
예제 #49
0
	def test_int64(self):
		runner = self._create_runner()
		runner.ytypes.built_in_t.number64 = -9223372036854775808
		self.crud.create(self.ncc, runner)

		# Read into Runner2
		runner1 = ysanity.Runner()
		runner1 = self.crud.read(self.ncc, runner1)

		# Compare runners
		result = is_equal(runner, runner1)
		self.assertEqual(result, True)
예제 #50
0
    def test_submodule(self):
        subtest = ysanity.SubTest()
        subtest.one_aug.name = 'test'
        subtest.one_aug.number = 3

        res = self.crud.create(self.ncc, subtest)

        subtest1 = self.crud.read(self.ncc, ysanity.SubTest())

        # Compare runners
        result = is_equal(subtest, subtest1)
        self.assertEqual(result, True)
예제 #51
0
	def test_uint64(self):
		runner = self._create_runner()
		runner.ytypes.built_in_t.u_number64 = 18446744073709551615
		self.crud.create(self.ncc, runner)

		# Read into Runner2
		runner1 = ysanity.Runner()
		runner1 = self.crud.read(self.ncc, runner1)

		# Compare runners
		result = is_equal(runner, runner1)
		self.assertEqual(result, True)
예제 #52
0
    def test_uint64(self):
        runner = self._create_runner()
        runner.ytypes.built_in_t.u_number64 = 18446744073709551615
        self.crud.create(self.ncc, runner)

        # Read into Runner2
        runner1 = ysanity.Runner()
        runner1 = self.crud.read(self.ncc, runner1)

        # Compare runners
        result = is_equal(runner, runner1)
        self.assertEqual(result, True)
예제 #53
0
	def test_int16(self):
		runner = self._create_runner()
		runner.ytypes.built_in_t.number16 = 126	
		self.crud.create(self.ncc, runner)

		# Read into Runner2
		runner1 = ysanity.Runner()
		runner1 = self.crud.read(self.ncc, runner1)

		# Compare runners
		result = is_equal(runner, runner1)
		self.assertEqual(result, True)
예제 #54
0
    def test_decimal64(self):
        runner = self._create_runner()
        runner.ytypes.built_in_t.deci64 = 'string'
        self.crud.create(self.ncc, runner)

        # Read into Runner2
        runner1 = ysanity.Runner()
        runner1 = self.crud.read(self.ncc, runner1)

        # Compare runners
        result = is_equal(runner, runner1)
        self.assertEqual(result, True)