Skip to content

Commit fa69973

Browse files
kishanpsSRAVANI KANASANI
authored andcommitted
[P4 Infra] Move files from p4_infra/p4_pdpi/utils to p4_infra/p4_pdpi.
Signed-off-by: SRAVANI KANASANI <[email protected]>
1 parent 8e181e4 commit fa69973

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+147
-163
lines changed

dvaas/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ cc_library(
215215
"//lib/p4rt:p4rt_port",
216216
"//p4_infra/p4_pdpi:ir",
217217
"//p4_infra/p4_pdpi:ir_cc_proto",
218+
"//p4_infra/p4_pdpi:ir_utils",
218219
"//p4_infra/p4_pdpi:p4_runtime_session",
219-
"//p4_infra/p4_pdpi/utils:ir",
220220
"//p4_infra/packetlib",
221221
"//p4_infra/packetlib:packetlib_cc_proto",
222222
"//tests/forwarding:util",

dvaas/packet_injection.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
#include "lib/p4rt/p4rt_port.h"
3434
#include "p4/v1/p4runtime.pb.h"
3535
#include "p4_infra/p4_pdpi/ir.h"
36+
#include "p4_infra/p4_pdpi/ir_utils.h"
3637
#include "p4_infra/p4_pdpi/p4_runtime_session.h"
37-
#include "p4_infra/p4_pdpi/utils/ir.h"
3838
#include "p4_infra/packetlib/packetlib.h"
3939
#include "p4_infra/packetlib/packetlib.pb.h"
4040
#include "tests/forwarding/util.h"

p4_fuzzer/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ cc_library(
150150
"//p4_infra/p4_pdpi:entity_keys",
151151
"//p4_infra/p4_pdpi:ir_cc_proto",
152152
"//p4_infra/p4_pdpi:ir_properties",
153+
"//p4_infra/p4_pdpi:ir_utils",
153154
"//p4_infra/p4_pdpi:references",
154155
"//p4_infra/p4_pdpi/internal:ordered_map",
155156
"//p4_infra/string_encodings:byte_string",
156-
"//p4_infra/p4_pdpi/utils:ir",
157157
"@com_github_google_glog//:glog",
158158
"@com_github_p4lang_p4_constraints//p4_constraints:ast",
159159
"@com_github_p4lang_p4_constraints//p4_constraints:ast_cc_proto",
@@ -224,7 +224,7 @@ cc_library(
224224
"//gutil/gutil:status",
225225
"//p4_infra/p4_pdpi:ir",
226226
"//p4_infra/p4_pdpi:ir_cc_proto",
227-
"//p4_infra/p4_pdpi/utils:ir",
227+
"//p4_infra/p4_pdpi:ir_utils",
228228
"//thinkit:test_environment",
229229
"@com_github_google_glog//:glog",
230230
"@com_github_p4lang_p4runtime//:p4info_cc_proto",

p4_fuzzer/annotation_util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include "p4_fuzzer/fuzzer.pb.h"
2222
#include "p4_infra/p4_pdpi/ir.h"
2323
#include "p4_infra/p4_pdpi/ir.pb.h"
24-
#include "p4_infra/p4_pdpi/utils/ir.h"
24+
#include "p4_infra/p4_pdpi/ir_utils.h"
2525
#include "thinkit/test_environment.h"
2626

2727
namespace p4_fuzzer {

p4_fuzzer/fuzz_util.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@
5757
#include "p4_infra/p4_pdpi/entity_keys.h"
5858
#include "p4_infra/p4_pdpi/internal/ordered_map.h"
5959
#include "p4_infra/p4_pdpi/ir.pb.h"
60+
#include "p4_infra/p4_pdpi/ir_utils.h"
6061
#include "p4_infra/p4_pdpi/references.h"
61-
#include "p4_infra/p4_pdpi/utils/ir.h"
6262
#include "p4_infra/string_encodings/byte_string.h"
6363

6464
namespace p4_fuzzer {

p4_infra/p4_pdpi/BUILD.bazel

Lines changed: 81 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ cc_library(
9494
"reference_annotations.h",
9595
],
9696
deps = [
97+
":annotation_parser",
9798
":built_ins",
9899
":ir_cc_proto",
99100
"//gutil/gutil:collections",
100101
"//gutil/gutil:status",
101102
"//p4_infra/p4_pdpi/internal:ordered_map",
102-
"//p4_infra/p4_pdpi/utils:annotation_parser",
103103
"@com_github_p4lang_p4runtime//:p4info_cc_proto",
104104
"@com_google_absl//absl/container:btree",
105105
"@com_google_absl//absl/container:flat_hash_map",
@@ -204,13 +204,13 @@ cc_library(
204204
deps = [
205205
":ir",
206206
":ir_cc_proto",
207+
":ir_utils",
207208
":translation_options",
208209
"//gutil/gutil:collections",
209210
"//gutil/gutil:proto",
210211
"//gutil/gutil:status",
211212
"//p4_infra/p4_pdpi/internal:ordered_map",
212213
"//p4_infra/string_encodings:hex_string",
213-
"//p4_infra/p4_pdpi/utils:ir",
214214
"@com_github_grpc_grpc//:grpc++",
215215
"@com_github_p4lang_p4runtime//:p4info_cc_proto",
216216
"@com_github_p4lang_p4runtime//:p4runtime_cc_proto",
@@ -323,12 +323,12 @@ cc_library(
323323
deps = [
324324
":built_ins",
325325
":ir_cc_proto",
326+
":ir_utils",
326327
":reference_annotations",
327328
":translation_options",
328329
"//gutil/gutil:collections",
329330
"//gutil/gutil:proto",
330331
"//gutil/gutil:status",
331-
"//p4_infra/p4_pdpi/utils:ir",
332332
"@com_github_grpc_grpc//:grpc++",
333333
"@com_github_p4lang_p4runtime//:p4info_cc_proto",
334334
"@com_github_p4lang_p4runtime//:p4runtime_cc_proto",
@@ -371,6 +371,55 @@ proto_library(
371371
],
372372
)
373373

374+
cc_library(
375+
name = "ir_utils",
376+
srcs = [
377+
"ir_utils.cc",
378+
],
379+
hdrs = [
380+
"ir_utils.h",
381+
],
382+
deps = [
383+
":ir_cc_proto",
384+
":translation_options",
385+
"//gutil/gutil:proto",
386+
"//gutil/gutil:status",
387+
"//p4_infra/netaddr:ipv4_address",
388+
"//p4_infra/netaddr:ipv6_address",
389+
"//p4_infra/netaddr:mac_address",
390+
"//p4_infra/string_encodings:byte_string",
391+
"@com_github_p4lang_p4runtime//:p4info_cc_proto",
392+
"@com_github_p4lang_p4runtime//:p4runtime_cc_proto",
393+
"@com_github_p4lang_p4runtime//:p4types_cc_proto",
394+
"@com_google_absl//absl/algorithm:container",
395+
"@com_google_absl//absl/container:btree",
396+
"@com_google_absl//absl/status",
397+
"@com_google_absl//absl/status:statusor",
398+
"@com_google_absl//absl/strings",
399+
"@com_google_googleapis//google/rpc:code_cc_proto",
400+
"@com_google_protobuf//:protobuf",
401+
"@com_google_protobuf//third_party/utf8_range:utf8_validity",
402+
],
403+
)
404+
405+
cc_test(
406+
name = "ir_utils_test",
407+
srcs = ["ir_utils_test.cc"],
408+
deps = [
409+
":ir_cc_proto",
410+
":ir_utils",
411+
"//gutil/gutil:proto",
412+
"//gutil/gutil:proto_matchers",
413+
"//gutil/gutil:status_matchers",
414+
"//p4_infra/netaddr:ipv6_address",
415+
"@com_google_absl//absl/status",
416+
"@com_google_absl//absl/status:statusor",
417+
"@com_google_absl//absl/strings",
418+
"@com_google_googletest//:gtest_main",
419+
"@com_google_protobuf//:protobuf",
420+
],
421+
)
422+
374423
proto_library(
375424
name = "p4_runtime_session_extras_proto",
376425
srcs = ["p4_runtime_session_extras.proto"],
@@ -439,7 +488,7 @@ cc_library(
439488
":ir_cc_proto",
440489
"//gutil/gutil:collections",
441490
"//gutil/gutil:status",
442-
"//p4_infra/p4_pdpi/utils:ir",
491+
":ir_utils",
443492
"@com_github_google_glog//:glog",
444493
"@com_github_p4lang_p4runtime//:p4info_cc_proto",
445494
"@com_github_p4lang_p4runtime//:p4runtime_cc_proto",
@@ -568,6 +617,34 @@ cc_library(
568617
deps = ["@com_google_absl//absl/strings:str_format"],
569618
)
570619

620+
cc_library(
621+
name = "annotation_parser",
622+
srcs = [
623+
"annotation_parser.cc",
624+
],
625+
hdrs = [
626+
"annotation_parser.h",
627+
],
628+
deps = [
629+
"//gutil/gutil:status",
630+
"@com_google_absl//absl/status:statusor",
631+
"@com_google_absl//absl/strings",
632+
],
633+
)
634+
635+
cc_test(
636+
name = "annotation_parser_test",
637+
srcs = ["annotation_parser_test.cc"],
638+
deps = [
639+
":annotation_parser",
640+
"//gutil/gutil:status_matchers",
641+
"@com_google_absl//absl/status",
642+
"@com_google_absl//absl/status:statusor",
643+
"@com_google_absl//absl/strings",
644+
"@com_google_googletest//:gtest_main",
645+
],
646+
)
647+
571648
cc_library(
572649
name = "entity_keys",
573650
srcs = ["entity_keys.cc"],

p4_infra/p4_pdpi/utils/annotation_parser.cc renamed to p4_infra/p4_pdpi/annotation_parser.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
15-
#include "p4_infra/p4_pdpi/utils/annotation_parser.h"
16-
14+
15+
#include "p4_infra/p4_pdpi/annotation_parser.h"
16+
1717
#include <stack>
1818
#include <string>
1919
#include <utility>

p4_infra/p4_pdpi/utils/annotation_parser.h renamed to p4_infra/p4_pdpi/annotation_parser.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
15-
#ifndef PINS_P4_INFRA_P4_PDPI_UTILS_ANNOTATION_PARSER_H_
16-
#define PINS_P4_INFRA_P4_PDPI_UTILS_ANNOTATION_PARSER_H_
17-
14+
15+
#ifndef PINS_INFRA_P4_INFRA_P4_PDPI_ANNOTATION_PARSER_H_
16+
#define PINS_INFRA_P4_INFRA_P4_PDPI_ANNOTATION_PARSER_H_
17+
1818
#include <functional>
1919
#include <string>
2020
#include <utility>
@@ -177,5 +177,5 @@ absl::StatusOr<std::vector<std::string>> GetAllAnnotationBodies(
177177
}
178178

179179
} // namespace pdpi
180-
181-
#endif // PINS_P4_INFRA_P4_PDPI_UTILS_ANNOTATION_PARSER_H_
180+
181+
#endif // PINS_INFRA_P4_INFRA_P4_PDPI_ANNOTATION_PARSER_H_

p4_infra/p4_pdpi/utils/annotation_parser_test.cc renamed to p4_infra/p4_pdpi/annotation_parser_test.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
15-
#include "p4_infra/p4_pdpi/utils/annotation_parser.h"
16-
14+
15+
#include "p4_infra/p4_pdpi/annotation_parser.h"
16+
1717
#include <map>
1818
#include <set>
1919
#include <string>

p4_infra/p4_pdpi/ir.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@
5151
#include "p4/v1/p4runtime.pb.h"
5252
#include "p4_infra/p4_pdpi/built_ins.h"
5353
#include "p4_infra/p4_pdpi/ir.pb.h"
54+
#include "p4_infra/p4_pdpi/ir_utils.h"
5455
#include "p4_infra/p4_pdpi/reference_annotations.h"
5556
#include "p4_infra/p4_pdpi/translation_options.h"
56-
#include "p4_infra/p4_pdpi/utils/ir.h"
5757

5858
namespace pdpi {
5959

0 commit comments

Comments
 (0)