예제 #1
0
    def test_conversion_url_to_dts_xpath_2(self):
        self.maxDiff = None
        url = "/api/running/rwrestconf-configuration/"  # trailing / on purpose
        expected = ""

        schema = load_multiple_schema_root(["rw-restconf"])

        actual = create_dts_xpath_from_url(url, schema)

        value = RwKeyspec.path_from_xpath(RwRestconfYang.get_schema(), actual, RwKeyspec.RwXpathType.KEYSPEC, None)
예제 #2
0
    def test_dts_xpath_multi_key(self):
        self.maxDiff = None
        url = "/api/config/multi-key/k1,k2"

        expected_xpath = "C,/vehicle-a:multi-key[foo = 'k1'][bar = 'k2']"

        schema = load_multiple_schema_root(["vehicle-a"])

        actual_xpath = create_dts_xpath_from_url(url, schema)

        self.assertEquals(actual_xpath, expected_xpath)
예제 #3
0
    def test_conversion_url_to_dts_xpath_2(self):
        self.maxDiff = None
        url = "/api/running/rwrestconf-configuration/"  # trailing / on purpose
        expected = ""

        schema = load_multiple_schema_root(["rw-restconf"])

        actual = create_dts_xpath_from_url(url, schema)

        value = RwKeyspec.path_from_xpath(RwRestconfYang.get_schema(), actual,
                                          RwKeyspec.RwXpathType.KEYSPEC, None)
예제 #4
0
    def test_conversion_url_to_dts_xpath(self):
        self.maxDiff = None
        url = "/api/operational/car/toyota/models"
        expected = ""

        schema = load_multiple_schema_root(["vehicle-a", "vehicle-augment-a"])

        actual = create_dts_xpath_from_url(url, schema)

        xpath = "D,/vehicle-a:car[vehicle-a:key_name = 'toyota']"
        value = RwKeyspec.path_from_xpath(VehicleAYang.get_schema(), actual, RwKeyspec.RwXpathType.KEYSPEC, None)
예제 #5
0
    def test_dts_xpath_multi_key(self):
        self.maxDiff = None
        url = "/api/config/multi-key/k1,k2"

        expected_xpath = "C,/vehicle-a:multi-key[foo = 'k1'][bar = 'k2']"

        schema = load_multiple_schema_root(["vehicle-a"])

        actual_xpath = create_dts_xpath_from_url(url, schema)

        self.assertEquals(actual_xpath, expected_xpath)
예제 #6
0
    def test_conversion_url_to_dts_xpath(self):
        self.maxDiff = None
        url = "/api/operational/car/toyota/models"
        expected = ""

        schema = load_multiple_schema_root(["vehicle-a", "vehicle-augment-a"])

        actual = create_dts_xpath_from_url(url, schema)

        xpath = "D,/vehicle-a:car[vehicle-a:key_name = 'toyota']"
        value = RwKeyspec.path_from_xpath(VehicleAYang.get_schema(), actual,
                                          RwKeyspec.RwXpathType.KEYSPEC, None)